fork download
  1. #include <stdio.h>
  2.  
  3. int Gcd(int a,int b){
  4. if (a%b!=0)
  5. return Gcd(b,a%b);
  6. else
  7. return b;
  8. }
  9.  
  10. int main(){
  11. int a = 12;
  12. int b = 30;
  13.  
  14. int gcd = Gcd(a,b);
  15. printf("Gcd(%d,%d)=%d\n",a,b,gcd);
  16.  
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 5456KB
stdin
Standard input is empty
stdout
Gcd(12,30)=6