fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int nwd(int a, int b)
  5. {
  6. if (a%b)
  7. return nwd(b, a%b);
  8. return b;
  9. }
  10.  
  11. int x;
  12. int main()
  13. {
  14. cin >> x;
  15. for (int i = 1; i <= x; i++)
  16. {
  17. int a, b;
  18. cin >> a >> b;
  19. cout << nwd(a, b) << endl;
  20. break;
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
Standard output is empty