Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int nwd(int n, int m)
- {
- int x;
- while (m != 0)
- {
- x = n % m;
- n = m;
- m = x;
- if (m == 0)
- return n;
- }
- }
- int main()
- {
- int n, m, wynik;
- cin >> n >> m;
- wynik = nwd(n, m);
- cout << wynik << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement