fork(2) download
  1. #include<stdio.h>
  2. int gcd(int a,int b)
  3. {
  4. if(a%b==0)
  5. return b;
  6. else
  7. return gcd(b,a%b);
  8. }
  9. int main()
  10. {
  11. int a,b;
  12. printf("Enter the numbers\n");
  13. scanf("%d %d",&a,&b);
  14. int x=gcd(a,b);
  15. printf("GCD of %d and %d is %d\n" ,a,b,x);
  16. return 0;
  17. }
Success #stdin #stdout 0s 2164KB
stdin
49 14
stdout
Enter the numbers
GCD of 49 and 14 is 7