Pagini recente » Cod sursa (job #486159) | Cod sursa (job #204431) | Cod sursa (job #2807049) | Cod sursa (job #3125640) | Cod sursa (job #6114)
Cod sursa(job #6114)
Program Factorial;
var f,g:text;
nrp,x,y,p:integer;
Begin
assign(f,'fact.in');
reset(f);
read(f,p);
If p<>0 then
begin
x:=5;
nrp:=1;
end
Else
x:=1;
while nrp<p do
begin
x:=x+5;
y:=x;
while (y mod 5=0) do
begin
nrp:=nrp+1;
y:=y div 5;
end;
end;
If p=5 then
x:=-1;
assign(g,'fact.out');
rewrite(g);
writeln(g,x);
close(g);
close(f);
End.