Cod sursa(job #2047319)

Utilizator pbseb7hkDaniel pbseb7hk Data 24 octombrie 2017 18:51:23
Problema Algoritmul lui Euclid Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.33 kb
#include <fstream>
using namespace std;
ifstream f("euclid2.in"); ofstream g("euclid2.out");
int n,a,b;
void cmmdc(int x, int y)
{
    int r;
    while(y)
        {r=x%y;
        x=y;
        y=r;
        }
    g<<x;
}
int main()
{
    f>>n;
    while(n--){f>>a>>b;cmmdc(a,b);g<<'\n';}
    g.close();
    return 0;
}