Cod sursa(job #2249489)
Utilizator | Data | 29 septembrie 2018 22:36:56 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.32 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("euclid2.in");
ofstream g("euclid2.out");
int main()
{
int a,b,t,n;
f>>n;
while(n)
{
f>>a>>b;
n--;
while(b)
{
t=b;
b=a%b;
a=t;
}
g<<a<<endl;
}
}