Cod sursa(job #2542183)

Utilizator ciprian_olaruCiprian Olaru ciprian_olaru Data 9 februarie 2020 17:37:20
Problema Factorial Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.31 kb
#include <iostream>
#include <fstream>
using namespace std;

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

int fact(long long int n) {
	if (n == 1)
		return 1;
	else
		return n * fact(n - 1);
}

int main() {
	int n;
	fin >> n;
	long long int res = fact(n);
	fout << res << '\n';
	return 0;
}