Cod sursa(job #2853325)
Utilizator | Data | 20 februarie 2022 10:35:37 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.45 kb |
#include <fstream>
using namespace std;
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
int main()
{
int n;
fin >> n;
for (int i = 0; i < n; i++)
{
unsigned int x, y;
fin >> x >> y;
int t = 0;
while (y != 0)
{
t = y;
y = x % y;
x = t;
}
fout << x << '\n';
}
fin.close();
fout.close();
return 0;
}