Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int a,b,c;
- int nww(int a, int b)
- {
- int w=a+b;
- while(a%w!=0 || b%w!=0)
- {
- w=w-1;
- }
- w=a*b/w;
- return w;
- }
- int main()
- {
- cout << "Podaj 2 liczby" << endl;
- cin >> a;
- cin >> b;
- cout << nww(a,b);
- cout << endl;
- cout << "Dla liczb 5,15" << endl;
- cout << nww(5,15);
- cout << endl;
- cout << "Dla liczb 7,49" << endl;
- cout << nww(7,49);
- return 0;
- }
Add Comment
Please, Sign In to add comment