TASK-
Write a C program for HCF of Two Numbers.
HCF= The highest common factors of each member of group
CODE:
#include<stdio.h>
int main()
{
int h,i,l=1,x,y;
//Asking number for HCF
printf("Enter two numbers: ");
printf("\n1- ");
scanf("%d",&x);
printf("\n2- ");
scanf("%d",&y);
for (i=1;i<=(x*y);i++)
{
if (x%i==0&&y%i==0)
l=i;
}
printf("Hcf of %d and %d is %d",x,y,l);
getchar();
return 0;
}
EXPECTED OUTPUT: