Cod sursa(job #32950)

Utilizator RobytzzaIonescu Robert Marius Robytzza Data 18 martie 2007 19:05:20
Problema Factorial Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.3 kb
#include<fstream.h>
int main(){
ifstream fin("fact.in");
ofstream fout("fact.out");
int P,nr=0,x=0,N=0;
fin>>P;
if (P==1)
    fout<<5;
else
while (N!=P){
     x+=5;
      nr=x;
      while (nr%5==0){
	    nr/=5;
	    N++;}
      }
      fout<<x;
fin.close();
fout.close();
return 0;
}