Cod sursa(job #1986552)

Utilizator BondyBondoc Alexandru Ionut Bondy Data 28 mai 2017 15:54:07
Problema Algoritmul lui Euclid Scor 30
Compilator cpp Status done
Runda Arhiva educationala Marime 0.38 kb
#include <fstream>

using namespace std;

int euclid(int a, int b){
    if( b == 0 ) return a;
    else return euclid( b, a%b );
}
int main()
{
    ifstream f ("euclid2.in");
    ofstream g ("euclid2.out");
    int a,b,rep;
    f >> rep;
    for( ;rep ; --rep ){
        f >> a >> b;
        g << euclid(a,b) << endl;
    }
    f.close();
    g.close();
    return 0;
}