fork download
  1. /*
  2.   Copyright 2011 Marek "p2004a" Rusinowski
  3.   Euclidean algorithm
  4. */
  5. #include <cstdio>
  6.  
  7. int gcd(int a, int b) {
  8. return b ? gcd(b, a % b) : a;
  9. }
  10.  
  11. int main() {
  12. int a, b;
  13. scanf("%d %d", &a, &b);
  14. printf("%d\n", gcd(a, b));
  15. return 0;
  16. }
  17.  
stdin
12 30
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:13: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
stdout
6