fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int x, y, m;
  6. cin >> x >> y;
  7. while( y !=0){
  8. m = x % y;
  9. x = y;
  10. y = m;
  11. }
  12. cout << x;
  13.  
  14. return 0;
  15. }
Success #stdin #stdout 0.01s 5280KB
stdin
20
8
stdout
4