Cod sursa(job #2452404)
Utilizator | Data | 30 august 2019 16:57:29 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.34 kb |
#include <fstream>
#include <cstdio>
using namespace std;
int T,x,y;
int cmmdc(int a, int b)
{
if(!b)
return a;
else
cmmdc(b,a%b);
}
int main()
{
ifstream f("euclid2.in");
ofstream g("euclid2.out");
f>>T;
for(;T>0;T--)
{
f>>x>>y;
g<<cmmdc(x,y)<<'\n';
}
f.close();
g.close();
return 0;
}