Cod sursa(job #2264762)
Utilizator | Data | 20 octombrie 2018 11:34:45 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
int x, y, aux, t;
fin >> t;
while (t > 0)
{
fin >> x >> y;
while (y)
{
aux = y;
y = x%y;
x = aux;
}
fout << x << endl;;
t--;
}
return 0;
}