fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int a, b;
  7. cin >> a >> b;
  8.  
  9. while (b != 0)
  10. {
  11. int pom1= a % b;
  12. a = b;
  13. b = pom1;
  14. }
  15.  
  16. // a ti jest nasze nwd;
  17.  
  18.  
  19. int c;
  20. cin >> c;
  21.  
  22. while(c!=0)
  23. {
  24. int pom2 = a %c;
  25. a = c;
  26. c = pom2;
  27.  
  28.  
  29. }
  30. cout << a;
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. return 0;
  39. }
Success #stdin #stdout 0.01s 5288KB
stdin
12 34 36
stdout
2