Introduction to Pseudocode notes (1)
Introduction to Pseudocode notes (1)
Pseudocode
• There are no definitive rules for writing pseudocode but it should make sense
and logically solve the problem/task.
What are the key characteristics that should be seen in the pseudocode?
• Use capital letters for keywords. Like INPUT, OUPUT, IF, THEN, ELSE, END IF.
Example: Write a pseudocode to add three numbers and find its average.
INPUT Num1
INPUT Num2
INPUT Num3
SumNum1+ Num2+ Num3
OUTPUT Sum
Sequence pseudocode:
• Write Pseudocode that will take two numbers as input, calculates their sum and
displays output.
• Write pseudo code that reads two numbers and multiplies them together and
print out their product.
• Write down Pseudocode that will take marks of physics, chemistry and math as
input, calculates the average and displays output.
• Write Pseudocode to find the area and perimeter of a rectangle and displays the
area and perimeter
Selection Statement:
Comparative operators:
Operat Descripti
Exampl Resul
or on
e t
Less
< 4<7
than True
Greater
> 4>7 False
than
Lesser or
<= 9 <= 8 False
equal to
Practice task:
1. Write a pseudocode that asks the user to input their exam score. If the score is
50 or above, the program should display "Congratulations, you passed!" If the
score is below 50, the program should display "Sorry, you failed. Better luck
next time.“
2. Write a pseudocode that prompts the user to enter their driving speed. If the
speed is over 70 mph, display "You are speeding! You may get a ticket." If the
speed is 70 mph or below, display "You are driving within the speed limit."
Combine condition:
Practice Task:
– A theme park give free entry for children below 5 age and senior citizenship.
Input age and check the entered age is eligible for free ticket or not.
– Write pseudocode for a weather system that outputs "Wear a jacket" if the
temperature is below 15°C OR if it is raining.
– Enter the day of the week. If day is Monday or Friday, display a message
“Exercise at Gym”, for all the other days, display a message “Exercise at home”.