This is the second disk of the PASCAL TUTOR system. It has the
Submitted By:
WEBMASTER
Rating:
(Not rated) (
Rate It)
(* Chapter 4 - Program 1 *)
program Demonstrate_Loops;
var Count : integer;
Start : integer;
Ending : integer;
Total : integer;
Alphabet : char;
begin
Start := 1;
Ending := 7;
for Count := Start to Ending do (* Example 1 *)
Writeln('This is a count loop and we are in pass',Count:4);
Total := 0;
for Count := 1 to 10 do begin (* Example 2 *)
Total := Total + 12;
Write('Count =',Count:3,' Total =',Total:5);
Writeln;
end;
Writeln;
Write('The alphabet is ');
for Alphabet := 'A' to 'Z' do (* Example 3 *)
Write(Alphabet);
Writeln;
for Count := 7 downto 2 do (* Example 4 *)
Writeln('Decrementing loop ',Count:3);
end.