Cod sursa(job #1040474)

Utilizator Mitsa3Neamt Mihai Mitsa3 Data 24 noiembrie 2013 16:08:21
Problema Algoritmul lui Euclid Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.39 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
void  euclid(int a, int b)
{
    int r=a%b;
    while(r)
    {
        a=b;
        b=r;
        r=a%b;
    }
    fout << b << "\n";
}
int main()
{
    int a,b,t;
    fin >> t;
    for(int i=1;i<=t;i++)
        fin >> a >> b,euclid(a,b);
    return 0;
}