#include<stdio.h>
#include<conio.h>
int hcf(int,int);
void main()
{
int n1,n2;
printf("Enter two numbers: ");
scanf("%d%d",&n1,&n2);
if(n1<=n2)
printf("HCF=%d",hcf(n1,n2));
else
printf("HCF=%d",hcf(n2,n1));
getch();
}
int hcf(int x,int y)
{
int i,h1,h2;
for(i=x;i>=1;i--)
{
h1=x%i;
h2=y%i;
if(h1==0 && h2==0)
return i;
break;
}
int n1,n2,min,i;
ReplyDeletescanf("%d%d",&n1,&n2);
min=(n1=1;i--)
{
if(n1%i==0 && n2%i==0)
{
printf("HCF is %d",i);
break;
}
}