Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int NWW(int a, int b)
- {
- int c=a*b;
- while(a!=b)
- {
- if(a>b)
- {
- a=a-b;
- }
- else
- {
- b=b-a;
- }
- }
- return c/a;
- }
- int main()
- {
- cout << NWW(54, 26) << endl;
- cout << NWW(97, 5) << endl;
- cout << NWW(512, 1024) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment