Page 47 - TP_iPlus_V2.1_Class8
P. 47
#Coding & Computational Thinking
Let’s CatCh Up
Write an algorithm to calculate the area of a triangle.
SOLVING PROBLEMS USING ALGORITHM AND
i +
FLOWCHART
Example 1: Write an algorithm and draw a
Flowchart:
flowchart to calculate the factorial of a number.
Start
Algorithm
Step 1 Start.
Step 2 Read the number n Read n
Step 3 Initialise i=1, fact=1
Step 4 Check If i < = n Then Repeat Step 5
to 6 until i=n i = 1
Step 5 fact=fact*i fact = 1
Step 6 i=i+1
Step 7 Print fact
Step 8 Stop. Is
False
i < = n?
True
fact = fact*i
Print fact
i = i + 1
Stop
45
Algorithms and Flowcharts

