fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4.  
  5. int main ()
  6. {
  7.  
  8. int n, x, max = 0;
  9.  
  10. cin >> n >> x;
  11.  
  12. for (int i = 1; i <= min(n, x); i++)
  13. {
  14. if (n % i == 0 && x % i == 0)
  15. {
  16. max = i;
  17. }
  18.  
  19. }
  20.  
  21. cout << max;
  22.  
  23.  
  24. }
  25.  
  26.  
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
Standard output is empty