Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4.  
  5. int NOD(int x, int y)
  6. {
  7. int i;
  8. while (x && y)
  9. if (x >= y) x %= y;
  10. else y %= x;
  11. return x | y;
  12. }
  13.  
  14. int main()
  15. {
  16. setlocale(0, "");
  17. int x, y;
  18. cout << "Первое число: ";
  19. cin >> x;
  20. cout << "Второе число: ";
  21. cin >> y;
  22. cout << "NOD -> " << NOD(x, y) << endl;
  23.  
  24.  
  25. system("pause");
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement