Cod sursa(job #17129)

Utilizator gabyboss29Gabi Munteanu gabyboss29 Data 14 februarie 2007 21:48:45
Problema Factorial Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.25 kb
#include<iostream.h>
#include <fstream.h>
int main()
{ long k=0,n=1,N=1,p,x;
ifstream f("fact.in");
f>>p;
x=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;
}