Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int NWD(int l1, int l2)
- {
- do
- {
- if(l1 > l2) {
- l1=l1-l2;
- } else {
- l2=l2-l1;
- }
- }
- while(l1 != l2);
- cout << l1;
- return 0;
- }
- int main()
- {
- int liczba1;
- int liczba2;
- cout << "Podaj pierwsza liczbe: " ;
- cin >> liczba1;
- cout << "Podaj druga liczbe: " ;
- cin >> liczba2;
- cout<<"Najwiekszy wspolny dzielnik podanych liczb to: ";
- NWD(liczba1,liczba2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement