Michal_Pilarski

zad18

Mar 21st, 2020
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. int a , b;
  2. void NWW()
  3. {
  4.     for(int i=1; i<=10000; i++)
  5.     {
  6.         if(i%a==0 && i%b==0)
  7.         {
  8.             cout<<i;
  9.             break;
  10.         }
  11.     }
  12. }
  13. int main()
  14. {
  15.     cout << "Podaj 2 liczby naturalne" << endl;
  16.     cin >> a >> b;
  17.     if(a<0 || b<0)
  18.     {
  19.         cout<<"To nie jest liczba naturalna"<<endl;
  20.     }
  21.     cout<<"Ich najmniejsza wspolna wielokrotnosc to: ";
  22.     NWW();
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment