Cod sursa(job #1448451)
Utilizator | Data | 7 iunie 2015 02:55:48 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.35 kb |
#include <iostream>
#include <fstream>
using namespace std;
long cmmdc(long a, long b){
if (!b) return a;
else cmmdc(b, a%b);
}
int main(){
ifstream ifile("euclid2.in");
ofstream ofile("euclid2.out");
long T, a, b;
ifile >> T;
while (T != 0){
T--;
ifile >> a >> b;
ofile << cmmdc(a, b) << "\n";
}
return 0;
}