Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- // ALGORYTM EUKLIDESA
- int main ()
- {
- int a, b, x, y;
- cout << "Podaj dwie liczby calkowite: ";
- cin >> x >> y;
- a = x;
- b = y;
- while(a != b)
- {
- if(a > b)
- a = a - b; // a -= b;
- if(b > a)
- b = b - a;
- }
- cout << "Najwiekszym wspolnym dzielnikiem liczb " << x << " i " << y << " jest liczba " << a << endl;
- cout << "Najmniejsza wspolna wielokrotnoscia liczb " << x << " i " << y << " jest liczba " << x * y / a << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment