Cod sursa(job #2352633)
Utilizator | Data | 23 februarie 2019 14:54:00 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.46 kb |
#include <iostream>
#include <fstream>
using namespace std;
long n;
long Euclid(long x, long y)
{
long aux=0;
while(y)
{
x =x%y;
long aux = x;
x = y;
y = aux;
}
return x;
}
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
int main()
{
fin>>n;
for(int i=0;i<n;i++)
{
long a,b;
fin>>a>>b;
fout<<Euclid(a,b)<<endl;;
}
return 0;
}