Algorithm and Flowcharts
Algorithm and Flowcharts
Algorithm
flowcharts
ALGORITHM
Every day you do certain things that require certain steps to be performed in order to get the
result that you want.
For example, when you get dressed for school, you have to follow these steps:
take a bath
take out uniform
change into your school uniform
put on your socks
polish your school shoes
put on your school shoes
comb your hair
After following these steps, you will be ready to go to school. Similarly, when you want to
perform a certain task on the computer, you have to follow certain steps and apply a certain
method to achieve the result.
This process of applying steps to solve a problem or perform an action is called an
ALGORITHM. Computers use algorithms to solve logical or mathematical problems. An
algorithm is always written in simple and precise language so that anyone can understand it.
You can write an algorithm on paper using a pen or a pencil; it does not necessarily have to be
done on the computer.
1
FLOWCHART
The different steps of an algorithm are represented in a FLOWCHART. A flowchart is pictorial
representation of an algorithm and displays each step sequentially using shapes to represent
an activity and arrows to indicate the sequence of actions.
The oval shape represents the START or END of a flowchart.
The parallelogram shape represents INPUT or OUTPUT in a flowchart.
The rectangle shape represents the INSTRUCTION being carried out.
The algorithm of how to get ready for school can be represented in a flowchart.
CONDITIONAL
The algorithm being used to solve a problem might change depending on the result of a
certain condition. These are called conditional algorithms. These algorithms provide two or
more possible outcomes. The results of these conditions may also require a certain step to be
repeated. These are called ITERATIONS or LOOPS.
2
For example: Algorithm to fill a glass of water.
Step 1: Place glass below tap
Step 2: Open tap
Step 3: Is glass full? If not then go back to Step 2. If yes then go to Step 4
Step 4: Close tap.
In flowcharts, the diamond shape represents the CONDITION used in the process. Only
one arrow can enter this shape, all other arrows have to come out of it from its corners.
You can use flowcharts and algorithms to solve mathematical problems too.
For example: Algorithm and flowchart to find which number is greater.
Step 1: Read A and B
Step 2: Is A>B. if yes, then go to Step 3. If not then go to
Step 4.
Step 3: A is greater.
Step 4: B is greater.
Step 5: stop.
3
SNAP RECAP
4
A. Tick the correct option.
1. Computers use algorithms to solve logical or _______ problems.
a. mathematical b. economic c. scientific
2. The rectangle shape represents the ________being carried out.
a. Questions b. problems c. instructions
3. The _______ shape represents the start or end of a flowchart.
a. diamond b. circular c. rectangular
4. A flowchart is a _______ representation of an algorithm
a. physical b. pictorial c. virtual
5. Arrows are to indicate the flow of the ________.
a. algorithm b. set c. sequence
6. An algorithm is always written in ______ and precise language.
a. different b. complicated c. simple
7. the Condition in a flowchart is represented by a ________ shape.
a. Square b. circular c. diamond
8. The algorithm being used to solve a problem might change depending on the result of a certain _____.
a. condition b.situation c. process
5
7. Diamonds in flowcharts represent conditional statement.
8. Loops are also called iterations.
6
E. Think and answer.
1. Roshni needs to find out the sum of two numbers. How does she do this using an algorithm?
2. Adam has to draw a flowchart to wash a dirty shirt. How would he do this using conditional
statements?
7
Fun with computers
8
Project Work
Work in groups of two. Write algorithms and draw flowcharts for any two daily activities.