Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  hcf1.c
Language: C/C++
Code:
#include <stdio.h>
int main()
{
     int n,d,r;
     printf("enter the value of n and d :");
     scanf("%d%d",&n,&d);
     if(n<d)
       {
         n=n+d;
         d=n-d;
         n=n-d;
       }
     r=n%d;
     while(n%d!=0)
       {
        r=n%d;
        n=d;
        d=r;
       }
     if(r!=0)
       printf("the hcf is = %d",r);
     else
       printf("the hcf is = %d",n);
     return 0;
}
          
Comments: