Advertisement
LukaszPanko

Zadanie 18

Mar 29th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int NWW(int l1, int l2)
  7. {
  8.     int i;
  9.     i = l1 * l2;
  10.     do
  11.     {
  12.         if(l1 > l2) {
  13.            l1 = l1 - l2;
  14.         } else {
  15.             l2 = l2 - l1;
  16.         }
  17.     }
  18.     while(l1 != l2);
  19.     cout<<i/l1;
  20.     return 0;
  21. }
  22.  
  23. int main()
  24. {
  25.     int liczba1;
  26.     int liczba2;
  27.     cout << "Podaj pierwsza liczbe: " ;
  28.     cin >> liczba1;
  29.     cout << "Podaj druga liczbe: " ;
  30.     cin >> liczba2;
  31.     cout<<"Najmniejsza wspolna wielokrotnosc podanych liczb to: ";
  32.     NWW(liczba1,liczba2);
  33.  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement