Explore 100's Of Free Video Tutorials

Keep Learning, Keep Coding & Keep Sharing

Introduction to Pseudo codes

Notes:

Introduction to Pseudo code :

Pseudo code:
(natural language + programming language [words and phrases, expressions])
Pseudo meaning is false; hence pseudo code is not an actual code
Instead of statements/instructions, pseudo code consists of words and phrases
That makes pseudo code to look quite similar to a program, but not a program
Pseudo codes are written with respect to programming language,
But programming language syntax or grammar is not strictly followed.
Pseudo code is a minimized version of an algorithm,
It is neither an algorithm nor a program

Algorithm: Find the sum of two given numbers (10, 10)
Step 1: Start [Start of algorithm]
Step 2: Declare a variable num1
Step 3: Declare a variable num2
Step 4: Declare a variable sum
Step 5: Assign the value 10 to variable num1
Step 6: Assign the value 10 to variable num2
Step 7: Add value in num1 and value in num2, and assign the result to variable sum
Step 8: Print the value in variable sum
Step 9: Stop [End of algorithm]

Ex: Pseudo code for sum of given two numbers (10, 10)

BEGIN
Dim num1
Dim num2
Dim sum
num1 = 10
num2 =10
sum = num1+ num2
DISPLAY sum
END

Benefits of pseudo code:
As it contain natural language words and phrases, easy to write, understand and modify
Pseudo codes are pre-plans, they help us to:
debug, check for correctness and efficiency before writing the program itself
Pseudo code can be easily translated to flowcharts then to a program

Limitations of pseudo code:
Pseudo code is written with respect to programming language,
Hence one pseudo code may be different from other pseudo code
Pseudo code cannot be run but program can be
Pseudo code has no visual representation like flowchart