#include<stdio.h>//header file
#include<stdio.h>//header file
void main() //starting of the main() function
{
int hcf,a,b,min,i,flag=0; //declaration of the variables
clrscr();
printf("program that calculates h.c.f. of two nos.");
printf("\n\n\n\t\t------------INPUT-------------");
printf("\n\nenter the two nos.");//taking input from the user
scanf("%d%d",&a,&b);
if(a<=b)
min=a;
else
min=b;
printf("\n\n\n\t\t------------OUTPUT------------");
for(i=min;i>=min/2;i--)
{
if(a%i==0 && b%i==0)
{
hcf=i;
flag=1;
printf("\n\nthe highest common factor is=%d",hcf);//printing output
break;
}
}
if(flag==0)
printf("\n\nthe highest common factor is= 1");//printing output
getch();
}