Cod sursa(job #30867)

Utilizator vladbBogolin Vlad vladb Data 15 martie 2007 11:08:18
Problema Factorial Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.49 kb
#include<fstream.h>
#include<math.h>

unsigned long p,n,c,e,i,d;

void citire();
void prel();
void afis();

void citire()
{  ifstream fin("fact.in");
   fin>>p;
   fin.close();
}

void prel()
{  if(p==0) n=1;
   for(i=1;i<pow(10,8);i++)
   {    d=i;
	while(d%5==0)
	{ d/=5;
	  e++;
	}
	if(e==p)
		{ n=i;
		  break;
		}
   }
}

void afis()
{  ofstream fout("fact.out");
   fout<<n;
   fout.close();
}

int main()
{  citire();
   prel();
   afis();
   return 0;
}