Pagini recente » Cod sursa (job #2506333) | Diferente pentru blog/98 intre reviziile 3 si 2 | Cod sursa (job #3303202) | Cod sursa (job #1460371) | Cod sursa (job #3311572)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
int main(){
int tests;
fin >> tests;
for(int test = 0; test < tests; test++){
int a, b;
fin >> a >> b;
if(a < b){
int aux = a;
a = b;
b = aux;
}
int r = a % b;
while(r != 0){
a = b;
b = r;
r = a % b;
}
fout << b << endl;
}
return 0;
}