fork download
  1. #include <stdio.h>
  2.  
  3. int GCD(int a,int b){ return (b==0)?a:GCD(b,a%b); }
  4.  
  5. int main(){
  6. int a,b;
  7. printf("Enter two numbers: ");
  8. scanf("%d%d",&a,&b);
  9. printf("GCD=%d",GCD(a,b));
  10. }
  11.  
Success #stdin #stdout 0.01s 5320KB
stdin
20 28
stdout
Enter two numbers: GCD=4