Cod sursa(job #1984869)

Utilizator ioan32Ioan Eftenoiu ioan32 Data 26 mai 2017 12:51:56
Problema Algoritmul lui Euclid Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.44 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("euclid2.in");
ofstream g("euclid2.out");

long euclid(long x, long y)
{

    long w;

    while(y)
    {
        w = x % y;

        x = y;

        y = w;

    }
    return x;

}

int main()
{
    long a, b, T;

    f>>T;

    while(T)
    {
        f>>a >>b;

        g<<euclid(a,b)<<'\n';

        T--;
    }




    return 0;
}