Cod sursa(job #2668023)

Utilizator H7GhosTsdfgsd asdf H7GhosT Data 4 noiembrie 2020 12:47:57
Problema Algoritmul lui Euclid Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.37 kb
#include <stdio.h>
using namespace std;


int main() {
    freopen("euclid2.in", "r", stdin);
    freopen("euclid2.out", "w", stdout);

    int t;
    scanf("%d", &t);
    while (t--) {
        int a, b;
        scanf("%d%d", &a, &b);

        int r;
        while (b) {
            r = a % b;
            a = b;
            b = r;
        }
        printf("%d\n", a);
    }
}