Cod sursa(job #1343696)
Utilizator | Data | 15 februarie 2015 20:01:30 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.23 kb |
#include<fstream>
using namespace std;
ifstream cin("fact.in");
ofstream cout("fact.out");
int fact(int x)
{
if(x==0) return 1;
else return x*fact(x-1);
}
int main()
{
int x;
cin>>x;
cout<<fact(x);
return 0;
}