Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int NWD(int a, int b)
- {
- while(a!=b)
- if(a>b)
- a=a-b;
- else
- b=b-a;
- return a;
- }
- int main()
- {
- int g_1=0, g_2=0;
- int attempts;
- cin>>attempts;
- for (int i=0; i<attempts; i++)
- {
- cin>>g_1;
- cin>>g_2;
- cout<<g_1/NWD(g_1, g_2)*g_2;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement