Cod sursa(job #421500)

Utilizator thewallDango David Narcis thewall Data 21 martie 2010 14:20:44
Problema Fractii Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.32 kb
#include <iostream>
#include <fstream>
using namespace std;

int cmmdc(int a, int b) {
	if(a%b==0) return b;
	else return cmmdc(b,a%b);
}

int main() {
	int a,b;
	ifstream f("cmmdc.in");
	f>>a>>b;
	ofstream g("cmmdc.out");
	int c=cmmdc(a,b);
	if(c==1) g<<0;
	else g<<c;
	f.close();
	g.close();
	return 0;
}