Cod sursa(job #2082478)
Utilizator | Data | 6 decembrie 2017 12:01:05 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.51 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{ifstream f("fact.in");
ofstream g("fact.out");
unsigned long long p,n,i,x=1,k,j;
f>>p;
x=0;
n=1;
cout<<p;
while (x==0)
{
k=1;
for (i=1;i<=n;i++)
k=k*i;
cout<<k<<endl;
if (k%10==0)
{j=0;
while (k && k%10==0)
{k=k/10;
j++;
}
}
if (j==p)
{cout<<n;x=1;
}
n++;
}
return 0;
}