Cod sursa(job #391675)

Utilizator horyathebest_10Un tip din Oradea horyathebest_10 Data 6 februarie 2010 01:15:43
Problema Algoritmul lui Euclid Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.28 kb
#include <fstream>
using namespace std;
int main()
{
long n,a,b,r;
ifstream f("euclid2.in");
ofstream o("euclid2.out");
f>>n;
while(n--)
     {
     f>>a>>b;
     while (b)
       {
       r=a%b;
       a=b;
       b=r;
       }
     o<<a<<"\n";
     }
return 0;
}