Cod sursa(job #2272874)
Utilizator | Data | 30 octombrie 2018 19:03:10 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.37 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("euclid2.in");
ofstream g("euclid2.out");
int n,i,x,y,r;
int main()
{
f >> n;
for(i = 1;i <= n; i++)
{
f >> x >> y;
while(y != 0)
{
r = x % y;
x = y;
y = r;
}
g << x <<"\n";
}
return 0;
}