Professional Documents
Culture Documents
1 NOT
3 + - OR
5
If-then-else-
Syntax for the if-then-else statement is:
if condition then S1 else S2;
for a := 1 to 10 do
begin
writeln('value of a: ', a);
12
end;
end.
NESTED LOOPS
A for loop can occur within another, so that the inner
loop (which contains a block of statements) is
repeated by the outer loop.
Syntax:
The syntax of a while-do loop is:
While (condition) do s;
program ProgWHILE_DO (output);
var i : integer;
begin
i=1;
while i<= 10 do
begin
writeln(i); 14
i=i+1;
end
end.
Repeat-Until Loop
Like a while statement, except that it tests the condition
at the end of the loop body.
Syntax:
repeat
S1;
S2;
...
...
Sn;
until condition;
EXERCISE
1. Write Repeat-Until Loop to display the following output 15
1 2 3 4 5 6 7 8 9 10
4. Write a program to calculate the summation of even numbers between 100 and 200.
18