Presentation is loading. Please wait.

Presentation is loading. Please wait.

FOR LOOP STRUCTURE For := to do eg. for I := 1 to 100 do begin writeln(‘This is a loop’); end;

Similar presentations


Presentation on theme: "FOR LOOP STRUCTURE For := to do eg. for I := 1 to 100 do begin writeln(‘This is a loop’); end;"— Presentation transcript:

1

2

3 FOR LOOP STRUCTURE For := to do eg. for I := 1 to 100 do begin writeln(‘This is a loop’); end;

4 For program example Program loops; var a: integer begin for a := 1 to 10 begin writeln(‘This is loop’, a); readln end; end.

5

6 While loop structure while do eg. read (num); while num <> 999 do begin sum := sum + num; writeln(‘the sum is’, sum); read(num); end;

7 WHILE PROGRAM EXAMPLE program squareroot; var square,num: integer begin read(num); while num <> 999 do begin square := num * num; writeln(‘ The square is’, square); read(num); end; end.

8 WHILE PROGRAM EXAMPLE program whileloop; var num: integer; begin while num < 25 do begin writeln(‘ this is loop number’ num); num := num +1 readln; end; end.

9

10 Repeat Until Loop Structure repeat until eg. repeat writeln(‘this is a loop again’); readln; a:=a +1 until a > 10

11 Repeat Until Loop Example program password; const password = 1234 var p: integer; begin repeat writeln(‘enter the password’); read(p); until p=password; end.


Download ppt "FOR LOOP STRUCTURE For := to do eg. for I := 1 to 100 do begin writeln(‘This is a loop’); end;"

Similar presentations


Ads by Google