Cod sursa(job #1037330)
Utilizator | Data | 20 noiembrie 2013 00:47:34 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.31 kb |
#include<fstream>
using namespace std;
ifstream I("euclid2.in");
ofstream O("euclid2.out");
int main()
{
int x,a,b,c;
I>>x;
for(int i=0;i<x;i++)
{
I>>a>>b;
while(b)
{
c=a%b;
a=b;
b=c;
}
O<<a<<endl;
}
return 0;
}