Cod sursa(job #2627330)
Utilizator | Data | 10 iunie 2020 14:21:43 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.31 kb |
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
long long n,p=1;fin>>n;
if(n==0)
{
fout<<1;
return 0;
}
for(int i=1; i<=n; i++)
p=p*i;
fout<<p;
fin.close();
fout.close();
return 0;
}