Pagini recente » Cod sursa (job #516518) | Cod sursa (job #2436715) | Cod sursa (job #1154763) | Cod sursa (job #2886110) | Cod sursa (job #791298)
Cod sursa(job #791298)
// Sorin Davidoi ([email protected]) - 2012-09-23 17:35
// http://infoarena.ro/problema/euclid2
#include <fstream>
using namespace std;
ifstream in("euclid2.in");
ofstream out("euclid2.out");
int main() {
int tests,first,second;
in >> tests;
for(int i = 0; i < tests; i++) {
in >> first >> second;
while(second) {
old_first = first;
first = second;
second = old_first % second;
}
out << first << '\n';
}
in.close();
out.close();
return (0);
}