Pagini recente » Cod sursa (job #2697950) | Borderou de evaluare (job #963670) | Cod sursa (job #2976115) | Cod sursa (job #467021) | Cod sursa (job #2193615)
// Infoarena.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <fstream>
using namespace std;
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
unsigned long euclid(unsigned long a, unsigned long b)
{
if (!b)
return a;
euclid(b, a%b);
}
int main()
{
unsigned long x, y, n;
fin >> n;
for (unsigned long i = 0; i < n; i++)
{
fin >> x >> y;
fout << euclid(x, y)<<"\n";
}
return 0;
}