Cod sursa(job #936731)
Utilizator | Data | 8 aprilie 2013 16:06:01 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.35 kb |
#include <fstream>
using namespace std;
ifstream ip("euclid2.in");
ofstream op("euclid2.out");
int main()
{
long long a,b,c,r,n;
ip>>n;
for(c=1;c<=n;c++)
{
ip>>a;
ip>>b;
while (a%b!=0)
{
r=a%b;
a=b;
b=r;
}
op<<b<<'\n';
}
return 0;
}