Cod sursa(job #3255125)
Utilizator | Data | 9 noiembrie 2024 15:10:21 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.37 kb |
#include <bits/stdc++.h>
using namespace std;
long long n, a, b, aux;
int f_cmmdc (int x, int y) {
while (y) {
int r = x % y;
x = y;
y = r;
}
return x;
}
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a >> b;
aux = f_cmmdc(a, b);
cout << aux << endl;
}
return 0;
}