Cod sursa(job #136188)
Utilizator | Data | 15 februarie 2008 11:47:21 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include<iostream.h>
#include<stdio.h>
int main ()
{int N,P,n=0,N2;
freopen ("factorial.in", "rt" ,stdin);
freopen ("factorial.out","wt" ,stdout);
scanf("%d",&P);
if (P==0) N=6;
else for (N=5;n<P;N=N+5) {N2=N;
while (N2%5==0) {N2=N2/5;
n++;}}
if (n>P) cout<<"nu exista";
if (n==P) printf("%d",N-5);
return 0;}