Pagini recente » Cod sursa (job #1395710) | Cod sursa (job #908479) | Cod sursa (job #379100) | Cod sursa (job #1074892) | Cod sursa (job #2643473)
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("euclid2.in");
ofstream g("euclid2.out");
unsigned long long cmmdc(unsigned long long a , unsigned long long b){
if(a < b){
swap(a , b);
}
unsigned long long c;
while(b){
c = a % b;
a = b;
b = c;
}
return a;
}
int main(){
int n; f >> n;
for(int i = 1; i <= n; i++){
unsigned long long x , y;
f >> x >> y;
g << cmmdc(x , y) << endl;
}
}