Академический Документы
Профессиональный Документы
Культура Документы
-ING
CONCEPTS
PAPER 2
SECTION 2: CHAPTER 11 PGS
UNIT
1
LOOP STRUCTURES
The syntax of a For…Next loop has three components: a counter,
a range, and a step
2
LOOP STRUCTURES
The 3 different loops structures:
3
LOOP STRUCTURES
4
LOOP STRUCTURES (PSEUDOCODE)
5
LOOP STRUCTURES
PROGRAM # 20
The syntax of a For…Next loop has three components: a counter,
a range, and a step
6
PROGRAM # 20 ( PSEUDOCODE )
7
PROGRAM # 20 (OUTPUT)
8
PROGRAM # 21
9
PROGRAM # 21 ( PSEUDOCODE)
10
PROGRAM # 21 (OUTPUT)
11
PROGRAM # 22
12
PROGRAM # 22 (PSEUDOCODE)
13
PROGRAM # 22 ( OUTPUT)
14
PROGRAM # 23 ( TO PRINT EVEN NUMBERS)
15
PROGRAM # 23 (PSEUDOCODE)
16
PROGRAM # 23 (OUTPUT)
17
PROGRAM # 24 ( TO PRINT ODD NUMBERS)
18
PROGRAM # 24 ( PSEUDOCODE )
19
PROGRAM # 24 ( OUTPUT )
20
PROGRAM # 25
( TO PRINT NUMBERS IN DESCENDING ORDER)
21
PROGRAM # 25 ( PSEUDOCODE )
22
PROGRAM # 25 ( OUTPUT )
23
PROGRAM # 26
( TO PRINT EVEN NUMBERS IN DESCENDING ORDER)
24
PROGRAM # 26 ( PSEUDOCODE)
25
PROGRAM # 26 ( OUTPUT)
26
PROGRAM # 27
( TO PRINT THE SUM OF 5 NUMBERS )
27
PROGRAM # 27 ( PSEUDOCODE)
28
PROGRAM # 27 ( OUTPUT)
29
PROGRAM # 28
( TO PRINT MULTIPLICATION TABLE )
30
PROGRAM # 28 ( PSEUDOCODE )
31
PROGRAM # 28 ( OUTPUT )
32
PROGRAM # 29
( TO SEPARATE POSITIVE AND NEGATIVE NUMBERS )
33
PROGRAM # 29 ( PSEUDOCODE )
34
PROGRAM # 29 ( OUTPUT )
35
BASIC TYPES OF CONTRUCTS
1. Sequence: a number of steps are performed, one after
the other. In other words, the order of statements followed
in programs.
2. Selection: Under certain conditions, some steps are
performed otherwise different ( or no) steps are performed.
3. Repetition: a sequence of steps is performed a number
of times.
36
BASIC TYPES OF CONTRUCTS
4. Counting: It is used with repetition with the variable counter
increased by 1 every time the loop repeated.
5. Totalling: It is used with repetition with the variable total
updated every time the loop repeated.
6. Assignment: an assignment statement gives a value
to a variable. For example, x = 5
y = 20
37
PRE-CONDITION LOOP
To execute a block of statements until the condition
becomes True, use the following syntax:
38
PROGRAM # 30
( TO PRINT FIRST 10 NUMBERS)
39
PROGRAM # 30 ( PSEUDOCODE )
40
PROGRAM # 30 ( OUTPUT )
41
PROGRAM # 31
42
PROGRAM # 31 ( PSEUDOCODE)
43
PROGRAM # 31 ( OUTPUT)
44
PROGRAM # 32
( TO SUM 6 DIFFERENT NUMBERS )
45
PROGRAM # 32 ( PSEUDOCODE )
46
PROGRAM # 32 ( OUTPUT )
47
PROGRAM # 33
( TO PRINT EVEN NUMBERS )
48
PROGRAM # 33 ( PSEUDOCODE )
49
PROGRAM # 33 ( OUTPUT )
50
PROGRAM # 34
( TO PRINT NUMBERS IN DESCENDING ORDER )
51
PROGRAM # 34 ( PSEUDOCODE )
52
PROGRAM # 34 ( OUTPUT )
53
PROGRAM # 35
( TO PRINT SUM OF NUMBERS FROM 1 TO 10)
54
PROGRAM # 35 ( PSEUDOCODE )
55
PROGRAM # 35 ( OUTPUT )
56
PROGRAM # 36
( TO PRINT MULTIPLICATION TABLE )
57
PROGRAM # 36 ( PSEUDOCODE )
58
PROGRAM # 36 ( OUTPUT )
59
PROGRAM # 37
( TO SEPARATE +VE AND –VE NUMBERS )
60
PROGRAM # 37 ( PSEUDOCODE )
61
PROGRAM # 37 ( OUTPUT )
62