Cod sursa(job #3372103)
| Utilizator | Data | 2 noiembrie 2026 15:03:18 | |
|---|---|---|---|
| Problema | Algoritmul lui Euclid | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.38 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("euclid2.in");
ofstream g("euclid2.out");
int main()
{
int n, i, x, y;
f >> n;
for (i = 0;i < n;i++)
{
f >> x >> y;
while (y!= 0)
{
int r = x % y;
x = y;
y = r;
}
g << x << " " << endl;
}
}
