Pagini recente » Cod sursa (job #2593037) | Cod sursa (job #3205361) | Cod sursa (job #1811493) | Cod sursa (job #2673242) | Cod sursa (job #1700605)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
unsigned t,a,b,i;
void cmd(int a,int b)
{
if(b==0)
{fout<<a;
fout<<"\n";}
else if(a>b)
cmd(b,a%b);
else
cmd(a,b%a);
}
void citire(int a,int b)
{
fin>>a>>b;
cmd(a,b);
}
int main()
{
fin>>t;
for(i=1;i<=t;i++)
{
citire(a,b);
}
fin.close();
fout.close();
return 0;
}