Cod sursa(job #3338269)

Utilizator newLerLorand New Eros newLer Data 2 februarie 2026 01:33:57
Problema Algoritmul lui Euclid Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.28 kb
#include <fstream>

using namespace std;

int gcd(int a, int b)
{
	if (b == 0) return a;

	return gcd(b, a % b);
}

int main()
{
	ifstream ifs("euclid2.in");
	ofstream ofs("euclid2.out");

	int a, b;
	ifs >> a >> b;
	
	ofs << gcd(a, b) << endl;

	return 0;
}