Cod sursa(job #2243585)
Utilizator | Nechifor Eduard Andrei eduardandrei20 | Data | 20 septembrie 2018 21:33:30 |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream in("euclid2.in");
ofstream out("euclid2.out");
int cmmdc(int a, int b) {
if (!b)
return a;
return cmmdc(b, a % b);
}
int main() {
int test, a, b;
in >> test;
while (test --) {
in >> a >> b;
out << cmmdc(a, b) << "\n";
}
return 0;
}