#include<iostream.h>
#include<conio.h>
int func_hcf(int u,int v);
void main()
{
int p,q,hcf,n;
int s[10];
clrscr();
cout<<"Specify the number of elements:";
cin>>n;
cout<<"Specify the elements:";
for(p=0;p<n;p++)
cin>>s[p];
for(p=0;p<n-1 ;p++)
{
hcf=func_hcf(s[p],s[p+ 1]);
s[p+ 1]=hcf;
}
cout<<"Highest Common Factor is: "<<hcf;
getch();
}
int func_hcf(int u,int v)
{
if(u%v==0)
return(v);
else
return(func_hcf(v, u%v));
}