We typically use short phrases or keywords to describe steps in a pseudocode.
For example: READ, WRITE, SET, IF, ELSE, ENDIF, WHILE, ENDWHILE, REPEAT, UNTIL
Pseudocodes omit language specific syntax.
It enables the programmers to concentrate on writing the coding
Algorithm/Pseudocode: Smaller of Three Numbers
1: Start
2: Declare variables n1, n2, and n3
3: Read variables n1, n2, and n3
4: If n1 is smaller than n2 and n3, then n1 smaller.
5: If n2 is smaller than n1 and n3, then n2 smaller.
6: If n3 is smaller than n1 and n2, then n3 smaller.
7: End
Read n1, n2, n3.
If n1 < n2:
If n1 < n3, Write n1.
Else Write n3
If n2 < n1:
If n2 < n3, Write n2.
Else Write n3.
Pseudocode: Find Sum of First 100 Natural Numbers
Step 1: Start
Step 2: Declare N and S.
Step 3: Set initial value of S to 0.
Step 4: Set initial value of N to 1.
Step 5: Add the value of N to S, giving S.
Step 6: Get the next number by add 1 to N.
Step 7: Repeat steps 5 to 6 until N is equal 100
Step 8: Display S.
Step 9: End
Set S to 0
Set N to 1
Repeat until N <=100:
Set S=S+N
Set N=N+1
Write S
What is Pseudocode?
Pseudocode is a high-level description of an algorithm or a computer program.
It uses natural language mixed with some programming language-like syntax to represent the logic of
a program without being bound to specific syntax rules.
Pseudocode is used in the planning and design phase of software development to outline the steps of a
program before actual coding begins.
Characteristics of Pseudocode:
Readability: Pseudocode should be easy to understand by anyone familiar with programming
concepts.
Flexibility: It allows for variations in coding style and syntax preferences.
No Formal Syntax: There's no strict syntax to follow, making it suitable for expressing algorithms in a
more human-readable form.
Variables: Represented by names and assigned values.
example: Set variable x ← 10
Input/Output Operations:
Input a from the user
Output "Hello, World!"
Output will always have ""