You are on page 1of 1

#include <bits/stdc++.

h>
#include <fstream>
using namespace std;

int main()
{
unsigned n,i,a,b,rest=0,c=0,d=0;
//int v[100];
ifstream f("numere.in");
ofstream g("numere.out");
f>>n;
for(i=1;i<=n;i++)
{f>>a>>b;
c=a;
d=b;
while(b!=0)
{
rest=a%b;
a=b;
b=rest;
}
g<<"cmmdc= "<<a<<" ";
g<<"Cmmmc= "<<(c*d)/a;
cout<<endl;
}
return 0;
}

You might also like