fork download
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int a ,b,rem;
  5. printf("Enter the two num:\n");
  6. scanf("%d %d",&a,&b);
  7. while(211){
  8. rem = a%b;
  9. if(rem==0){
  10. rem=b;
  11. break;
  12. }
  13. a=b;
  14. b=rem;
  15.  
  16. }
  17. printf("Gcd is %d:",b);
  18. }
Success #stdin #stdout 0s 5288KB
stdin
12 18
stdout
Enter the two num:
Gcd is 6: