Cod sursa(job #283309)

Utilizator sandyxpSanduleac Dan sandyxp Data 18 martie 2009 23:21:35
Problema Algoritmul lui Euclid Scor 60
Compilator cpp Status done
Runda Arhiva educationala Marime 0.33 kb
#include <fstream>
using namespace std;

#define NUME "euclid2"
ifstream fi(NUME".in");
ofstream fo(NUME".out");

int cmmdc(int a, int b) {
    if (b == 0) return a;
    return cmmdc(b, a%b);
}

int main()
{
    int T, x, y;
    fi >> T;
    while (T--) {
        fi >> x >> y;
        fo << cmmdc(x, y) << "\n";
    }
    return 0;
}