Cod sursa(job #2862288)
Utilizator | Data | 5 martie 2022 11:09:41 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.64 kb |
#include <fstream>
using namespace std;
ifstream cin("fact.in");
ofstream cout("fact.out");
int main()
{
int n;
cin>>n;
int ok=1,i=0,nr10=0;
while(ok)
{
i++;
if(i%10==0)
{
int ci=i;
while(ci%10==0)
{
ci=ci/10;
nr10++;
if(nr10==n) ok=0;
}
}
else if(i%5==0)
{
int ci=i;
while(ci%5==0)
{
ci=ci/5;
nr10++;
if(nr10==n) ok=0;
}
}
}
cout<<i;
}