Cod sursa(job #2342536)

Utilizator Alx09Drula Alex Alx09 Data 12 februarie 2019 21:33:02
Problema Algoritmul lui Euclid Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.35 kb
#include <iostream>
#include <fstream>

using namespace std;
ifstream f("euclid2.in");
 ofstream g("euclid2.out");
int cmmdc(int x,int y)
{
    if(!y) return x;
    else return cmmdc(x,x%y);
}

int main()
{
   int n ;
    f >> n;
    for(int i=1, a, b;i <= n; i++)
    {
        f >> a >> b;

         g << cmmdc(a,b) << '\n';
    }
}