Cod sursa(job #1467402)
Utilizator | Data | 3 august 2015 12:54:08 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.47 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("euclid2.in");
ofstream out("euclid2.out");
int main()
{
int T,a,b,r;
fin>>T;
if(T>=1 && T<=100000)
{
for(;T;T--)
{
fin>>a>>b;
while(b)
{
r=a%b;
a=b;
b=r;
}
out<<a<<'\n';
}
}
fin.close();
out.close();
return 0;
}