Cod sursa(job #2479589)
Utilizator | Data | 23 octombrie 2019 23:41:39 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.29 kb |
#include <fstream>
using namespace std;
ifstream f("euclid2.in");
ofstream g("euclid2.out");
int euclid(int a,int b)
{
if(!b)
return a;
return euclid(b,a%b);
}
int main()
{
int n,a,b;
f>>n;
while(n--)
{f>>a>>b;
g<<euclid(a,b)<<'\n';}
}