Advertisement
KingaGolas

zad18

Mar 29th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int NWW (int a, int b)
  6. {
  7. for (int c=a; c>0; c+=a)
  8. {
  9. if (c%a==0 && c%b==0)
  10. {
  11. return c;
  12. }
  13.  
  14. }
  15.  
  16. }
  17.  
  18. int main()
  19. {
  20. cout<< NWW (3,9) <<endl;
  21. cout<< NWW (24,56) <<endl;
  22. cout<< NWW (1,8) <<endl;
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement