Cod sursa(job #2277243)

Utilizator SemetgTemes George Semetg Data 5 noiembrie 2018 21:42:50
Problema Algoritmul lui Euclid Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.33 kb
#include <fstream>
#include <iostream>
#include <cstdio>
using namespace std;

ifstream in { "euclid2.in" };
ofstream out { "euclid2.out" };

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

int main() {
    int t; in >> t;
    
    while (t--) {
        int a, b; in >> a >> b;
        out << cmmdc(a, b) << '\n';
    }
}