Cod sursa(job #1644976)

Utilizator serbanSlincu Serban serban Data 10 martie 2016 10:29:36
Problema Algoritmul lui Euclid Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.32 kb
#include <fstream>

using namespace std;

int main()
{
    ifstream f("euclid2.in");
    ofstream g("euclid2.out");
    int n, x, y, z; f >> n;
    for(; n; n --) {
        f >> x >> y;
        while(y) {
            z = x % y;
            x = y; y = z;
        }
        g << x << "\n";
    }
    return 0;
}