Cod sursa(job #256530)

Utilizator botaMihai Botezatu Catalin bota Data 11 februarie 2009 21:04:58
Problema Factorial Scor 10
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.32 kb
var p,nr,i,x:longint;
    g,h:text;
begin
assign(g,'fact.in');
reset(g);
assign(h,'fact.out');
rewrite(h);
read(g,p);x:=1;
while p>nr do begin
i:=i+1;
x:=x*i;
if x mod 10<>0 then x:=x mod 10;
while x mod 10=0 do begin
x:=x div 10;
nr:=nr+1;
end;
x:=x mod 10;
end;
write(h,i);
close(g);
close(h);
end.