Cod sursa(job #529752)
Utilizator | Data | 5 februarie 2011 21:30:08 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.27 kb |
#include<fstream.h>
#include<stdio.h>
ifstream f("fact.in");
ofstream g("fact.out");
int main(){
long p,i=1,n,fact=1,zero=0;
f>>p;
while(zero<p){
fact=fact*i;
if(fact%10==0){
zero++;
fact=1;
}
i++;
}
g<<(i-1)<<"\n";
return 0;
}