Cod sursa(job #2714415)
Utilizator | Data | 1 martie 2021 19:47:11 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.4 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
int main()
{
int n, x, y, r;
fin >> n;
while(n != 0)
{
fin >> x >> y;
while(y != 0)
{
r = x % y;
x = y;
y = r;
}
fout << x << "\n";
n--;
}
return 0;
}