Christmas 2000 Exercise (3i)

HKCEE 1999 Paper 2 (1)

(a)

Line

Corrected statement

75

writeln

100

read(table1[i,j])

180

read(table2[i,j]);

190

table1[i,j]:=table2[i,j]+table1[i,j]

200

end; writeln;

245

begin for j:=1 to 4 do

250

write(table2[i,j], _ );

255

end; writeln

 

(b)

Program bank(input, output);

var P,RAMT, I, N, FLAG:real;

begin

writeln(_Enter the principal: $_);

readln(P);

write(_Enter the monthly amount that needs to be returned: $_);

readln(RAMT);

write(_Enter the interest rate: _);

readln(I);

N:=0;

FLAG:=0;

while (FLAG=0) do

begin

P:=P + P*I;

if(P<=RAMT)

then FLAG:=1

else begin

P:=P-RAMT;

N:=N+1

end

end;

writeln(_The number of repayment installments required is, N+1)

end.

1