MarcinKrol

Zad18

Mar 24th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. //Zad18
  4.  
  5.  
  6. using namespace std;
  7.  
  8. //Zad18
  9.  
  10.  
  11. int a , b;
  12. void NWW()
  13. {
  14. for(int i=1; i<=10000; i++)
  15. {
  16. if(i%a==0 && i%b==0)
  17. {
  18. cout<<i;
  19. break;
  20. }
  21. }
  22. }
  23. int main()
  24. {
  25. cout << "Podaj 2 liczby naturalne" << endl;
  26. cin >> a >> b;
  27. if(a<0 || b<0)
  28. {
  29. cout<<"To nie jest liczba naturalna"<<endl;
  30. }
  31. cout<<"Ich najmniejsza wspolna wielokrotnosc to: ";
  32. NWW();
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment