Cod sursa(job #287722)
Utilizator | Data | 25 martie 2009 08:20:24 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.29 kb |
#include<fstream>
#include<iostream>
using namespace std;
int main()
{
int p,n=0,e=0;
ifstream fin("fact.in");
fin>>p;
fin.close();
ofstream fout("fact.out");
if(p==0)n=1;
while(p)
{
e++;
n+=5;
p--;
if(e==5)p--,e-=5;
}
fout<<n;
fout.close();
return 0;
}