Cod sursa(job #1428489)

Utilizator GrecuDianaSorinaGrecu Diana-Sorina GrecuDianaSorina Data 4 mai 2015 17:39:17
Problema Algoritmul lui Euclid Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.32 kb
#include<fstream>
using namespace std;
ifstream f("euclid2.in");
ofstream g("euclid2.out");
int i,n,a,b,r;
int main()
{
    f>>n;
    for(i=1;i<=n;i++)
    {
        f>>a>>b;
        while(b>0)
        {
            r=a%b;
            a=b;
            b=r;
        }
        g<<a<<"\n";
    }
    return 0;
}