Cod sursa(job #2604937)
Utilizator | Data | 23 aprilie 2020 23:31:54 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.4 kb |
#include <fstream>
#include <iostream>
#include <iomanip>
using namespace std;
ifstream f("euclid2.in");
ofstream g("euclid2.out");
int main()
{
int T, a, b;
f >> T;
while( T )
{
f >> a >> b;
while( b )
{
int rest = a % b;
a = b;
b = rest;
}
g << a << "\n";
}
return 0;
}