Cod sursa(job #2502390)
Utilizator | Data | 30 noiembrie 2019 19:28:33 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include <fstream>
using namespace std;
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
int main()
{
long long t, a, b, c;
fin >> t;
for(int i=1;i<=t;i++)
{
fin >> a >> b;
while(b!=0)
{
c=a%b;
a=b;
b=c;
}
fout<<a<<'\n';
}
return 0;
}