Page 38 - IT_V5.0_Class6
P. 38
Problem 12: Write an algorithm to input NAME and AGE from user and display if he/she is a
teenager or not.
(Hint: If the AGE is between 13 and 19, it's called Teenager)
The process for this algorithm is:
To check if AGE is between 13 and 19 or not
The output for this Algorithm is:
Display “TEEANAGER” if AGE is greater than 12 and less than 20
Step 1: Start
Step 2: Input NAME.
Step 3: Input AGE.
Step 4: IF AGE > 12 and AGE < 20 THEN
Display NAME, "Teenager".
Step 5: ELSE
Display NAME, "Not a Teenager".
Step 6: Stop
Problem 13: Write an algorithm to input COLOUR of traffic light from user and display an
appropriate message.
(Hint: Red: Stop, Green: Go, Orange: Wait)
The desired Output will be:
If COLOUR is Red, then display Stop
If COLOUR is Green, then display Go
If COLOUR is Orange, then display Wait
Step 1: Start
Step 2: Input COLOUR.
Step 3: IF COLOUR is "Red", THEN
Print "Stop".
Step 4: ELSE IF COLOUR is "Green", THEN
Print "Go".
Step 5: ELSE IF COLOUR is "Orange", THEN
Print "Wait".
Step 6: ELSE
Print "INVALID COLOUR".
Step 7: Stop
Problem 14: Write an algorithm to display "Hello" 5 times.
Step 1: Start
Step 2: Set a variable Num=1
Step 3: Repeat until NUM reaches 5.
Print "Hello".
36 Information Technology (V5.0)-VI

