For Loop:
Program forLoop;
uses wincrt;
var
i : integer;
c : char;
c : char;
begin
for i := 0 to 100 do
begin
writeln(i,'. Holla World');
end;
writeln('==========================');
for i := 100 downto 10 do
begin
writeln(i,'. Holla World Again');
end;
writeln('===========================');
for c := 'a' to 'z' do
begin
writeln(c,'. characters');
end;
writeln('===========================');
for c := 'a' to 'z' do
begin
writeln(c,'. characters');
end;
end.
While Loop:
Program whileLoop;
uses wincrt;
var
i : integer;
begin
i := 0;
while i<100 do
begin
writeln(i,'. Less than 100');
i := i+1;
end;
end.
Repeat Until
Program untilLoop;
uses wincrt;
var
i : integer;
begin
i := 1;
Repeat
writeln(i,'. Holla World');
writeln('This holla comes from turbo pascal');
i := i + 1;
until i = 100;
end.
No comments:
Post a Comment