Cod sursa(job #2759451)
Utilizator | Data | 17 iunie 2021 19:51:08 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.31 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("euclid.in");
ofstream fout("euclid.out");
int main()
{
int nr1,nr2,rest,x,i;\
fin >> x;
for (i=1;i<=x;i++){
fin >> nr1 >> nr2;
while(nr2 != 0)
{ rest = nr1 % nr2;
nr1 = nr2;
nr2 = rest;
}
fout<< nr1 << "\n";
}
}