Cod sursa(job #2241865)
Utilizator | Data | 17 septembrie 2018 10:59:00 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.34 kb |
#include <iostream>
#include <fstream>
using namespace std;
int n, x, y;
ifstream fin ("euclid2.in");
ofstream fout ("euclid2.out");
int cmmdc(int a, int b)
{
if (b == 0) return a;
return cmmdc(b, a%b);
}
int main()
{
fin >> n;
for(; n; --n)
{
fin >> x >> y;
fout << cmmdc(x, y) << endl;
}
return 0;
}