Cod sursa(job #1324738)
Utilizator | Data | 22 ianuarie 2015 18:58:21 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.4 kb |
#include <fstream>
using namespace std;
int gcd(int a, int b) {
if(b == 0)
return a;
else
return gcd(b, a % b);
}
int main() {
int a, b, T;
ifstream in("euclid2.in");
ofstream out("euclid2.out");
in >> T;
while(T--) {
in >> a >> b;
out << gcd(a, b) << '\n';
}
in.close();
out.close();
return 0;
}