#include<conio.h>
#include<stdio.h>
void main()
{
int num1,num2,min,i;
printf(“Enter two
numbers : ”);
scanf(“%d%d”,&num1,&num2);
min=(num1>num2)?num2:num1;
for(i=min;i>=1;--i)
{
if(num1%i==0&&num2%i==0)
{
printf(“HCF
of %d and %d is %d”,num1,num2,i);
break;
}
}
getch();
}
OUTPUT :
Enter two number 5 10
HCF of 5 and 10 is 5
0 comments:
Post a Comment