Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int NOD(int x, int y)
- {
- int i;
- while (x && y)
- if (x >= y) x %= y;
- else y %= x;
- return x | y;
- }
- int main()
- {
- setlocale(0, "");
- int x, y;
- cout << "Первое число: ";
- cin >> x;
- cout << "Второе число: ";
- cin >> y;
- cout << "NOD -> " << NOD(x, y) << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement