Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a, b;
- cout << "Podaj dwie liczby naturalne: ";
- cin >> a >> b;
- if(a * b == 0)
- {
- cout << "Liczby te nie maja wspolnego dzielnika.\n";
- }
- while(a != b)
- {
- if(a > b)
- a -= b;
- if(b > a)
- b -= a;
- }
- cout << "Najwiekszy wspolny dzielnik tych liczb wynosi " << a << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement