Cod sursa(job #2707214)
Utilizator | Data | 16 februarie 2021 17:59:01 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.44 kb |
#include<iostream>
#include<fstream>
using namespace std;
ifstream fin("Euclid2.in");
ofstream fout("Euclid2.out");
long long Euclid2(long long x,long long y)
{ int r;
while(y!=0)
{
r=x%y;
x=y;
y=r;
}
return x;
}
int main()
{ long long n,a,b;
fin >> n;
for(int i=1; i<=n; ++i)
{
fin >> a >> b;
fout << Euclid2(a,b) << endl;
}
return 0;
}