Cod sursa(job #2989171)

Utilizator CodreanuCCezar Codreanu CodreanuC Data 6 martie 2023 08:32:27
Problema Algoritmul lui Euclid Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.36 kb
#include <bits/stdc++.h>

using namespace std;

ifstream fin("euclid2.in");
ofstream fout("euclid2.out");

int main()
{
    int n, x, y, r;
    fin>>n;
    for(int i=1;i<=n;++i){
        fin>>x>>y;
        while(y!=0){
            int r = x % y;
            x = y;
            y = r;
        }
        fout << x << "\n";
    }
    return 0;
}