Cod sursa(job #679744)

Utilizator sleepaholicNeculaescu Theodor sleepaholic Data 13 februarie 2012 17:58:03
Problema Algoritmul lui Euclid Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.31 kb
#include<fstream>
using namespace std;
int functie( int x, int y)
{
int r;
while(y)
{
r=x%y;
x=y;
y=r;
}
return x;
}
int n,x,y,i;
int main()
{
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
fin>>n;
for(i=1;i<=n;i++)
{
fin>>x>>y;
fout<<functie(x,y);
fout<<"\n";
}
return 0;
}