fork download
  1. #include <stdio.h>
  2.  
  3. int fac(int hcf,int h)
  4.  
  5. {
  6.  
  7. int i,j;
  8.  
  9.  
  10. for( i=1; i <=hcf && i <=h; ++i)
  11.  
  12. {
  13.  
  14.  
  15. if(hcf%i==0 && h%i==0)
  16.  
  17. j=i;
  18.  
  19. }
  20. printf("H.C.F of %d and %d is %d", hcf, h,j);
  21.  
  22. }
  23.  
  24.  
  25. int main()
  26. {
  27.  
  28. int gcd,i;
  29.  
  30. printf("enter numbers \n");
  31.  
  32. scanf("%d %d", &gcd, &i);
  33.  
  34. fac(gcd,i);
  35.  
  36. return 0;
  37.  
  38. }
  39.  
Success #stdin #stdout 0s 10320KB
stdin
48
64
stdout
enter numbers 
H.C.F of 48 and 64 is 16