Table of contents
Flow of the program
Flow Chart :- Visualization of our thought process of Algorithm and representing them diagrammatically is called a flow chart.
- Start / Stop -> An oval shape indicates the starting and ending points of the flow chart
- Input / Output -> A parallelogram is used to represent input and output in a flow chart.
- Processing -> A rectangle is used to represent process such as mathematical computation or variable assignment.
- Condition -> A diamond shape is used to represent a conditional statement which results in true or false (Yes or No).
- Flow direction of program -> An arrow shape is used to represent the flow of the program.
Example 1 :- Take a name and output hello name
Example 2 :- Take input of a salary. If the salary is greater than 10,000 add a bonus of 2000, otherwise add a bonus of 1000.
Example 3 :- Input a number and print whether it is prime or not.
Pseudocode
- Pseudocode is like a rough code which represents how the algorithm of a program works.
- In simple words, It is just a way to unite steps which is human-readable format.
- It does not require syntax.
- It is mainly meant for human reading, not for machine reading.
Pseudocode of Example 1
Step 1 : start
Step 2 : Input name
Step 3 : Output name
Step 4 : exit
Pseudocode of Example 2
start
Input Salary
if Salary > 10000 :
Salary = Salary+2000
else :
Salary = Salary+1000
Output Salary
exit
Pseudocode of Example 3
start
Input num
if num ≤ 1
print “Nither prime nor composite”
c = 2
while c < num
if num % c = 0
Output “Not Prime”
Exit
c = c+1
end while
Output “Prime”
exit