Cod sursa(job #404207)

Utilizator spring-blossomAnca I spring-blossom Data 25 februarie 2010 21:26:59
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.31 kb
#include<fstream.h>
#include<math.h>
ifstream f("fact.in");
ofstream g("fact.out");
int gasit,s,n,p,c;
int main()
{
	f>>p;
	c=pow(10,p);
	s=1;
	n=0;
	gasit=0;
	while ( !gasit )
	  { n++;
	   s=s*n;
	   if ( s%c==0 )
		  { g<<n;
	        gasit=1;}
	  }
    f.close();
    g.close();
    return 0;
}