Cod sursa(job #2228575)
Utilizator | Data | 4 august 2018 12:06:47 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("euclid2.in");
ofstream out("euclid2.out");
int gcd2(int a, int b) {
if(0 < b)
return gcd2(b, a % b);
else
return a;
}
int main() {
int t, a, b;
in >> t;
for(int i = 0; i < t; i++) {
in >> a >> b;
out << gcd2(a, b) << "\n";
}
return 0;
}