Pagini recente » Borderou de evaluare (job #1423193) | Borderou de evaluare (job #1808727) | Cod sursa (job #1124272) | Cod sursa (job #3004012) | Cod sursa (job #2761602)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("factorial.in");
ofstream fout("factorial.out");
int main()
{
int nr;
fin>>nr;
if(nr==0)
{
fout<<1;
return 0;
}
int n=1;
int nr_fact = 0;
while(nr_fact<nr)
{
if(n%5==0)
{
int cn=n;
while(cn!=0 && cn%5==0)
{
nr_fact++;
cn/=5;
}
}
n++;
}
fout<<n-1;
return 0;
}