Cod sursa(job #792474)

Utilizator Sm3USmeu Rares Sm3U Data 27 septembrie 2012 13:25:42
Problema Algoritmul lui Euclid Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.46 kb
#include <cstdio>

using namespace std;

int cmmdc (int x, int y){
    if (y == 0){
        return x;
    }
    return cmmdc (y, x % y);
}

void  citire(){
    int t;
    scanf ("%d", &t);
    while (t--){
        int x;
        int y;
        scanf ("%d%d", &x, &y);
        printf ("%d\n", cmmdc (x, y));
    }
}

int main()
{
    freopen ("euclid2.in", "r", stdin);
    freopen ("euclid2.out", "w", stdout);

    citire();

    return 0;
}