Cod sursa(job #2869083)
Utilizator | Data | 11 martie 2022 12:25:08 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.42 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
int n;
int Euclid(int a, int b)
{
int aux;
while (b > 0)
{
aux = a;
a = b;
b = aux % b;
}
return a;
}
int main()
{
fin >> n;
int x, y;
while (n--)
{
fin >> x >> y;
fout << Euclid(x, y) << '\n';
}
return 0;
}