// Program to find the greatest common factor
#include
#include
void main()
{
int gcm(int,int);
int num1,num2,gcf,choice;
clrscr();
do
{
printf(" Enter two numbers -->");
scanf(" %d %d",&num1,&num2);
gcf=gcm(num1,num2);
printf(" The greatest common factor of ");
printf("%d and %d is --> %d",num1,num2,gcf);
printf(" \n Wish to continue.........");
printf("\n \t 1.) To continue \n \t \t 2.) Exit \n");
scanf("%d",&choice);
}
while(choice==1);
getch();
}
int gcm(int a ,int b)
{
int p,h;
p=a*b;
for(int i=1;i<=p;i++)
{
if(a%i==0&&b%i==0)
h=i;
}
return (h);
}