Professional Documents
Culture Documents
Lesson 1,2 Pseudocodeflowchartexamples-180402195549
Lesson 1,2 Pseudocodeflowchartexamples-180402195549
FLOWCHART
EXAM PLES C
sum
Pseudocode & Flowchart Example 2
Calculate Perimeter of Rectangle
1 BEGIN
2 NUMBER b1,b2,area,perimeter
3 INPUT b1
4 INPUT b2
5 area=b1*b2
6 perimeter=2*(b1+b2)
7 OUTPUT area
8 OUTPUT perimeter area
9 END
perimeter
Pseudocode & Flowchart Example 3
Find Perimeter Of Circle using Radius
BEGIN
2 NUMBER r, perimeter
3 INPUT r
4 area=3.14*2*r
5 OUTPUT perimeter
6 END
perimeter
Pseudocode & Flowchart Example 4
Calculate sales taxes
BEGIN
3 NUMBER price, tax, taxRate, total
4
5 OUTPUT "Enter Product Price"
6 INPUT price
7 OUTPUT "Enter tax rate
8 amoung 1 and 100"
9 OKU taxRate
10
11 tax= price* taxRate/100
12 total= price + tax
13
14 OUTPUT "Product tax="+tax
15 OUTPUT "Product total price ="+total
END
Pseudocode & Flowchart Example 5
Check a Number is Positive or Negative
BEGIN
5
6
7 NUMBER num
8
9 OUTPUT "Enter a Number"
10 INPUT num
11
12
IF num>0 THEN
13 OUTPUT "Entered number is
14 positive" ELSE IF num <0 THEN
15 OUTPUT "Entered number is
16 negative" ELSE
OUTPUT "Entered number is
zero"
ENDIF
END
Pseudocode & Flowchart Example 7
Print Numbers from 1 to 100
BEGIN
2 NUMBER counter
3
4 FOR counter = 1 TO 100 STEP 1
5 OUTPUT counter
6 ENDFOR
7
8 END
Pseudocode & Flowchart Example 9
Read 10 numbers and find sum of even numbers
1
2
BEGIN
3 NUMBER counter, sum=0, num
4
5
FOR counter=1 TO 10 STEP
6 1 DO OUTPUT "Enter a
7
8
Number" INPUT num
9 IF num % 2 == 0 THEN
10
11
sum=sum+num
12 ENDIF
13
14
ENDFOR
15 OUTPUT sum
Introduction to Creating
Flowcharts
https://
www.youtube.com/watch?v=S
WRDqTx8d4k