Cod sursa(job #2648005)

Utilizator urweakurweak urweak Data 7 septembrie 2020 22:12:57
Problema Algoritmul lui Euclid Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.3 kb
#include <iostream>
using namespace std;

int gcd(int x, int y){
    while(y){
        int c = x % y;
        x = y;
        y = c;
    }
    return x;
}

int main(){
    int n, x, y;
    cin >> n;
    for(int i = 1; i<=n; i++){
        cin >> x >> y;
        cout << gcd(x, y);
    }
}