Cod sursa(job #2517861)
| Utilizator | Data | 4 ianuarie 2020 13:18:26 | |
|---|---|---|---|
| Problema | Algoritmul lui Euclid | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.53 kb |
#include <bits/stdc++.h>
#define open ios::sync_with_stdio(false);
#define close fin.close(); fout.close(); return 0;
using namespace std;
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
int a, b;
int euclid()
{
int aux;
while(b)
{
aux = a % b;
a = b;
b = aux;
}
return a;
}
void citire()
{
fin >> a >> b;
}
int main()
{
open
int t;
fin >> t;
while(t--)
{
citire();
fout << euclid() << "\n";
}
close
}
