Cod sursa(job #600644)
Utilizator | Data | 2 iulie 2011 18:11:26 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.43 kb |
#include <fstream>
using namespace std;
int n;
inline int cmmdc(int a, int b)
{
}
int main()
{
int i, a, b, ax;
ifstream f("euclid2.in");
ofstream g("euclid2.out");
f >> n;
for(i = 1; i <= n; ++i)
{
f >> a >> b;
while(b)
{
ax = a % b;
a = b;
b = ax;
}
g << a << '\n';
}
g.close();
return 0;
}