Cod sursa(job #2356204)

Utilizator StefanUUngureanu Stefan Cristian StefanU Data 26 februarie 2019 16:00:52
Problema Algoritmul lui Euclid Scor 40
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.33 kb
#include <bits/stdc++.h>

using namespace std;

int gcd(int a, int b)
{
    return (b==0)?a:gcd(b,a%b);
}


int main()
{
    freopen("euclid2.in","r",stdin);
    freopen("euclid2.out","w",stdout);
     int a,b,n;
    cin>>n;
    while(n){
    cin >>a>>b;
    cout<<gcd(a,b)<<endl;
    n--;
    }
    return 0;
}