fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. int a = 54, b = 32;
  7. int r = a % b;
  8.  
  9. while (r > 0) {
  10. a = b;
  11. b = r;
  12. r = a % b;
  13. }
  14.  
  15. cout << "gcd = " << b << endl;
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5392KB
stdin
Standard input is empty
stdout
gcd = 2