Friday, March 17, 2023

"find the value of hcf of two numbers " using c

 //find the value of hcf of two numbers


#include <stdio.h>
int main (){
    int n1,n2,hcf ,i;
    printf ("enter the value of two numbers :");
    scanf ("%i%i",&n1,&n2);
    for (i=1;i<=n1||i<=n2;i++){
        if (n1%i==0 && n2%i==0){
            hcf =i;
        }

    }
printf ("the value of hcf of n1 and n2 is %i\n",hcf );
return 0;
}

No comments:

Post a Comment

print a multiplication table of any integer taking from user

 // print a multiplication table of any integer taking from user  #include "stdio.h" int main () { int n,mul,i; printf ("...