Pagini recente » Cod sursa (job #2291374) | Cod sursa (job #1937572) | Cod sursa (job #121565) | Cod sursa (job #2533040) | Cod sursa (job #1692080)
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <fstream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
int cmmdc(int x, int y)
{
int r = x%y;
while (r)
{
x = y;
y = r;
r = x%y;
}
return y;
}
int t, a, b;
int main()
{
fin >> t;
while (t--)
{
fin >> a >> b;
fout << cmmdc(a, b) << '\n';
}
return 0;
}