Skip to content
“`html Flow Charts and Pseudocode

Flow Chart

Definition: A flow chart is a pictorial representation of the steps in an algorithm. It represents different steps of an algorithm using standard symbols.

A flow chart is useful because it helps us understand the flow of execution of a program easily.

Why Do We Use Flow Charts?

  • To represent an algorithm visually.
  • To understand the order of program execution.
  • To make complex problems easier to understand.
  • To find mistakes in an algorithm before writing the actual program.
  • To explain a program to other people.

Common Flow Chart Symbols

Symbol Name Purpose
Oval Start / Stop Shows the beginning or end of a program.
Rectangle Process Represents an operation or calculation.
Parallelogram Input / Output Used to read input or display output.
Diamond Decision Used when a condition needs to be checked.
Arrow Flow Line Shows the direction of execution.

Input and Output

Input

Input is an activity used to collect data from the end-user and store it in the program.

Examples:

  • Entering a student’s name
  • Entering a number
  • Entering marks
  • Entering age

Output

Output is an activity used to display information, a response, or a result from the program to the end-user.

Examples:

  • Displaying a number
  • Displaying the sum of two numbers
  • Displaying a student’s result

Example 1: Add Two Numbers

Let’s create an algorithm and pseudocode to add two numbers: 12 and 24.

Algorithm

  1. Start the program.
  2. Reserve memory space with the name a.
  3. Store the value 12 into a.
  4. Reserve another memory space with the name b.
  5. Store the value 24 into b.
  6. Reserve another memory space with the name sum.
  7. Add the values in a and b and store the result in sum.
  8. Display the value of sum on the monitor.
  9. Stop the program.

Pseudocode

1. START
2. DECLARE a
3. a := 12
4. DECLARE b
5. b := 24
6. DECLARE sum
7. sum := a + b
8. WRITE "sum =", sum
9. STOP
    

Explanation

The program first creates three variables: a, b, and sum.

The values 12 and 24 are stored in a and b. Then the program calculates:

sum = a + b

Therefore: sum = 12 + 24 = 36

Output

sum = 36

Flow of Execution

Flow: Start → Declare a → a = 12 → Declare b → b = 24 → Declare sum → sum = a + b → Display sum → Stop

Example 2: Get a Number from the User

In the previous example, the values were already given. Now let’s create an algorithm that allows the user to enter a number.

Algorithm

  1. Start the program.
  2. Reserve some memory space in RAM to store a number and assign the name a to it.
  3. Show a message to the user asking them to enter a number.
  4. Take the number entered by the user and store it in a.
  5. Display the value stored in a on the monitor.
  6. Stop the program.

Pseudocode

1. START
2. DECLARE a
3. WRITE "Enter a number"
4. READ a
5. WRITE "Value of a =", a
6. STOP
    

Explanation

READ is used to take input from the user.

WRITE is used to display a message or result to the user.

If the user enters 50, the value 50 is stored in the variable a.

Sample Output

Enter a number
50
Value of a = 50

Important Pseudocode Commands

Command Meaning Example
START Begins the algorithm. START
STOP Ends the algorithm. STOP
DECLARE Creates a variable. DECLARE a
READ Takes input from the user. READ a
WRITE Displays information or output. WRITE a
:= Assigns a value to a variable. a := 12

Algorithm → Pseudocode → Flow Chart

These three are different ways of representing the same problem.

  1. Algorithm: Written step-by-step instructions.
  2. Pseudocode: A simple, programming-like representation of the algorithm.
  3. Flow Chart: A visual representation using standard symbols.

Simple Example

Problem: Read a number and display it.

Representation Solution
Algorithm 1. Start
2. Declare a
3. Ask the user to enter a number
4. Read a
5. Display a
6. Stop
Pseudocode START
DECLARE a
WRITE “Enter a number”
READ a
WRITE “Value of a =”, a
STOP
Flow Chart Start → Declare a → Input a → Display a → Stop

Practice Questions

Write the algorithm, pseudocode, and flow chart for each of the following programs.

Q1. Read two numbers from the user and display their sum.
Q2. Read two numbers and display their difference.
Q3. Read two numbers and display their product.
Q4. Read two numbers and display their average.
Q5. Read a number and display its square.
Q6. Read a person’s age and display the age.
Q7. Read the length and width of a rectangle and calculate its area.
Q8. Read the side of a square and calculate its area.
Q9. Read a student’s name and marks and display both values.
Q10. Read two numbers and display their sum, difference, and product.

Practice: Convert Previous Programs

Activity: Take the algorithms from your previous programs and convert each one into:
  1. Pseudocode
  2. Flow chart

Quick Revision

  • A flow chart is a pictorial representation of an algorithm.
  • Standard symbols are used to represent different activities.
  • Input collects data from the user.
  • Output displays information or results.
  • DECLARE creates a variable.
  • READ takes input.
  • WRITE displays output.
  • := is used for assigning a value to a variable.
  • START begins an algorithm.
  • STOP ends an algorithm.
Flow Charts & Pseudocode — Practice Notes
“`