var
num, sqrNum : Integer;
begin
num := 1;
sqrNum := num * num;
// Display squares of integers until we reach 100 in value
While sqrNum <= 100 do
begin
// Show the square of num
ShowMessage(IntToStr(num)+' squared = '+IntToStr(sqrNum));
// Increment the number
Inc(num);
// Square the number
sqrNum := num * num;
end;
end;
沒有留言:
張貼留言