Uploaded by kadian.ramkissoon

For Loop

advertisement
Section 1
1.
Pseudocode
Dim x as Integer
For x from 1 to 10 do
Print x
End for
Code
Flowchart
Start
X= 1
Print x
X=x+1
If x >10
Yes
End
2.
Pseudocode
Dim x as Integer
For x from 10 to 1 step -1 do
Print x
End
Code
2. Flowchart
Start
X= 10
Print x
X = x -1
If x = 1
Yes
End
3.
Pseudocode
Dim x as Integer
For x from 1 to 10 step 2 do
Print x
End
Code
3. Flowchart
Start
X= 1
Print x
X=x+2
If x = 9
Yes
End
4.
Pseudocode
For i = 1 to 4
print"Enter the length of a rectangle"
input l
print"Enter the breadth of a rectangle"
input b
Perimeter= l + b
print "The area is", area
End for
Code
Flowchart
Start
X=1
Print “Enter the
length and the
breadth”
Read l , b
Perimeter = l + b
Print Area
X = x +1
If x > 5
If x > 5
End
5.
6.
7.
8.
9.
10.
Download