Pagini recente » Cod sursa (job #2046023) | Diferente pentru problema/perioada2 intre reviziile 7 si 6 | Cod sursa (job #1655214) | Diferente pentru problema/kbiti intre reviziile 14 si 4 | Cod sursa (job #2541226)
#include <iostream>
using namespace std;
#define fisier "euclid2"
#ifdef fisier
#include <fstream>
ifstream in(fisier ".in");
ofstream out(fisier ".out");
#else
#define in cin
#define out cout
#endif
int n, a, b;
int cmmdc() {
if (!b)
return a;
while (a %= b)
swap(a, b);
return b;
}
int main() {
in >> n;
while (n--) {
in >> a >> b;
out << cmmdc() << '\n';
}
}