Cod sursa(job #17211)

Utilizator gabyboss29Gabi Munteanu gabyboss29 Data 15 februarie 2007 08:33:57
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.28 kb
#include<iostream.h>
#include<math.h>
#include <fstream.h>
int main()
{ long k=0,n=1,N=1,p,x;
ifstream f("fact.in");
f>>p;
x=pow(10,p);
if(p==0)
k=1;
else
while(n!=k)
{n++;
N=N*n;
if(N%x==0)
k=n;}
ofstream g("fact.out");
g<<k;
f.close();
g.close();
return 0;
}