why so much mem?
Posted: Wed Sep 25, 2002 9:35 am
how it's possible that this code spend 320kb of memory?
program factor;
const
F7=string('5040');
F8=string('40320');
F9=string('362880');
F10=string('3628800');
F11=string('39916800');
F12=string('479001600');
F13=string('6227020800');
sOver=('Overflow!');
sUndr=('Underflow!');
var
dato:longInt;
begin
readln(dato);
while (not eof(input)) do
begin
readln(dato);
if dato<0 then begin
if dato mod 2 = 0 then writeln(sUndr) else writeLn(sOver) end
else begin
case dato of
0..6: writeLn(sUndr);
7: writeLn(F7);
8: writeLn(F8);
9: writeLn(F9);
10: writeLn(F10);
11: writeLn(F11);
12: writeLn(F12);
13: writeLn(F13);
else writeLn(sOver);
end; end;
end;
end.
I really don't understand that a 36 lines program with a single variable can be so memory greedy
program factor;
const
F7=string('5040');
F8=string('40320');
F9=string('362880');
F10=string('3628800');
F11=string('39916800');
F12=string('479001600');
F13=string('6227020800');
sOver=('Overflow!');
sUndr=('Underflow!');
var
dato:longInt;
begin
readln(dato);
while (not eof(input)) do
begin
readln(dato);
if dato<0 then begin
if dato mod 2 = 0 then writeln(sUndr) else writeLn(sOver) end
else begin
case dato of
0..6: writeLn(sUndr);
7: writeLn(F7);
8: writeLn(F8);
9: writeLn(F9);
10: writeLn(F10);
11: writeLn(F11);
12: writeLn(F12);
13: writeLn(F13);
else writeLn(sOver);
end; end;
end;
end.
I really don't understand that a 36 lines program with a single variable can be so memory greedy