Pseudocode
Pseudocode
●
A Pseudocode is a step-by-step description of a computer program or an
algorithm.
●
Pseudocode is not a programming language.
●
Pseudocode is written in code like structure using plain English text.
●
Flowchart is an alternative to Pseudocode.
Example:
BEGIN
IF you are happy
THEN smile
ENDIF
END
●
It helps the programmer in planning the solution to the problem.
●
It helps others to understanding the approach to the problem.
3 Keywords
●
In Pseudocode, they are used to indicate common input-output and
processing operations. They are written fully in uppercase.
PRINT, DISPLAY : This will show your output to a screen or the relevant output device.
Pseudocode:
BEGIN
INPUT first_number
INPUT second_number
sum = first_number + second_number
PRINT sum
END
Algorithm: Pseudocode:
●
Start BEGIN
●
Input the first number. INPUT first_number
●
Input the second number. INPUT second_number
●
If the first number is greater than the second number then IF first_number > second_number THEN
●
Display the first number as the largest. PRINT first_number
●
Else
ELSE
●
Display the second number as the largest.
PRINT second_number
●
End If
END IF
●
End
END
Using ELSEIF
7
BEGIN
INPUT temperature
ELSE
END IF
END
2)Write a pesudocode for a program that asks user for name and age. Then it should display <name> you
are <an adult/teenager/child>
Start
Input
number
Yes
If
Number % 2 = 0 Print “Even”
No
Print “Odd”
End