(* Tersa Tong F.4AS 30 November, 2001 *)
(* Find the sum of the cubes from 1 to N *)
program cube_sum;
uses wincrt;
var sum, I ,N: longint;
begin
I:=1;
write('enter the limit?');
readln(N);
writeln;
while I <= N do
begin
writeln('cube of ', I,': ', I*I*I);
sum:= sum+I*I*I;
I:= I+1
end;
writeln;
writeln('the sum is ', sum)
end.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=---=--=-
e.g.
1) enter the limit? 3
cube of 1: 1
cube of 2: 8
cube of 3: 27
the sum is 36
2) enter the limit? 6
cube of 1: 1
cube of 2: 8
cube of 3: 27
cube of 4: 64
cube of 5: 125
cube of 6: 216
the sum is 441
               (
geocities.com/ttt_7_ttt)