//find the hcf of any two numbers
#include <stdio.h>
int main (){
int num1,num2,i,hcf ;
printf ("enter two numbers :");
scanf ("%i%i",&num1,&num2);
for (i=1;i<=num1&&i<=num2;i++){
if (num1%i==0 && num2%i==0){
hcf =i;
}
}
printf ("hcf of %i and %i is %i ",num1,num2,hcf);
return 0;
}
No comments:
Post a Comment