Cod sursa(job #2979048)
Utilizator | Data | 14 februarie 2023 19:00:26 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.43 kb |
#include <bits/stdc++.h>
long long cmmdc(long long a, long long b)
{
if (b == 0)
return a;
else return cmmdc(b, a % b);
}
int main()
{
std :: freopen("prim.in", "r", stdin);
std :: freopen("prim.out", "w", stdout);
int n; scanf("%d", &n);
while (n --)
{
long long a, b;
scanf("%lld %lld", &a, &b);
printf("%lld\n", cmmdc(a, b));
}
return 0;
}