Pagini recente » Cod sursa (job #1514054) | Cod sursa (job #971288) | Cod sursa (job #982839) | Cod sursa (job #2018880) | Cod sursa (job #2059745)
#include <iostream>
#include <fstream>
using namespace std;
int gcd(int a , int b)
{
if (a==b){ return a;}
while (a!=b){ return a;}
{
if (a>b){ return gcd(a%b,b); }
else {
return gcd(a,b%a);
}
}
}
int main()
{
ifstream f("euclid2.in");
ofstream g("euclid2.out");
int t;
int a;
int b;
f>>t;
for ( int i=1; i<= t; i++)
{
f>>a>>b;
g << gcd(a,b) << endl;
}
}