Cod sursa(job #2718355)
Utilizator | Data | 8 martie 2021 18:12:13 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.32 kb |
#include <fstream>
using namespace std;
ifstream fin("euclid.in");
ofstream fout("euclid.out");
int main()
{ int n,a,b;
for (int i=1;i<=n;i++)
{
fin>>a>>b;
while(a != b)
if(a > b)
a -= b;
else
b -= a;
fout<<a<<endl;
}
return 0;
}