Advertisement
Lukasz_Miskiewicz

Zadanie 18

Mar 31st, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int a,b,c;
  4.  
  5. int nww(int a, int b)
  6. {
  7. int c=a+b;
  8. while(a%c!=0 || b%c!=0)
  9. {c=c-1;}
  10. c=a*b/c;
  11. return c;
  12. }
  13.  
  14. int main()
  15. {
  16. cout<<"podaj dwie liczby naturalne"<<endl;
  17. cin>>a;
  18. cin>>b;
  19. cout<<"najmniejsza wspolna wielokrotnosc"<<endl;
  20. cout<< nww(a,b);
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement