Pagini recente » Cod sursa (job #2654756) | Cod sursa (job #1813283) | Cod sursa (job #1678523) | Cod sursa (job #1474276) | Cod sursa (job #2653633)
#include <bits/stdc++.h>
using namespace std;
string problem = "euclid2";
ifstream fin (problem + ".in");
ofstream fout(problem + ".out");
//https://www.infoarena.ro/problema/euclid2
int euclid(int a,int b)
{
while(b)
{
int aux = a % b;
a = b;
b = aux;
}
return a;
}
int main()
{
int t;
fin >> t;
while(t--)
{
int a,b;
fin >> a >> b;
fout << euclid(a,b) << "\n";
}
}