Cod sursa(job #1605160)

Utilizator TeodorCotetCotet Teodor TeodorCotet Data 18 februarie 2016 20:03:47
Problema Algoritmul lui Euclid Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.33 kb
#include <bits/stdc++.h>

using namespace std;

ifstream fin("euclid2.in");
ofstream fout("euclid2.out");

int n; 

int cmmdc(int x, int y) {

	if(y == 0)
		return x;

	return cmmdc(y, x % y);
}

int main() {

	cin >> n; 

	while(n--) {

		int x; int y;
		fin >> x >> y;
		fout << cmmdc(x, y) << '\n'; 
	}
}