Cod sursa(job #1587470)
Utilizator | Data | 2 februarie 2016 08:36:39 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.29 kb |
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int N;
long long factorial(int x)
{ if(x==1 || x==0)
return 1;
else
return x*factorial(x-1);
}
int main()
{
fin>>N;
long long f=factorial(N);
fout<<f;
return 0;
}