Class-7
ALGORITHM AND FLOWCHART
ALGORITHM
Software is a set of programs and a program is the set of instructions given to a
computer to perform a specific task.
Programs are step-by-step instructions. But before making a program we
finalize the steps that the program needs to perform. A good algorithm or
flowchart helps us to specify the steps so that we can make a better program.
The algorithm is a step-wise representation of a solution to a given problem. In
Algorithm the problem is broken down into smaller pieces or steps. Hence, it is
easier for the programmer to convert it into an actual program.
Let us understand it with the example of cooking a new recipe. To cook a
recipe, one reads the instructions and steps and executes them one by one, in
the given sequence. The result thus obtained is the new dish cooked perfectly.
Similarly. An algorithm is a procedure used for solving a problem or performing
a computation.
Characteristics of an Algorithm
1. Every step should be clear and simple, with only one meaning.
2. An algorithm may take some data as input, or sometimes no input at all.
3. The result (output) must be shown clearly and match what is expected.
4. It should always finish after a certain number of steps, not go on forever.
5. The steps should be possible to do with the resources we have.
6. It should be written in plain instructions so it can be changed into any
coding language later.
Class-7
Advantages Of Using Algorithms:
- Easy to understand and follow.
- Helps in solving big problems by breaking them into small steps.
- Makes computer programs better and more organized.
FLOWCHART
A flowchart is a picture or diagram that shows the steps of an algorithm. It uses
different symbols, shapes, and arrows to explain how a process or program works.
Computers easily understand numbers, but for humans it is easier to learn
through visuals. That’s why flowcharts are used — they break a process into
smaller steps and show it clearly in a visual form.
That is why flowcharts are useful — they break a big process into smaller steps
and show it in a picture form, so it is easier to understand and explain.
In a flowchart, special symbols are used to show different actions, and arrows
are used to connect the steps in the right order.
Flowchart Symbol Name Purpose
Start/stop box A terminal box is used to represent the
or terminal box starting or end of the flowchart. It is
represented by a rounded rectangle.
Input/output This box is used to take input and display
box output. It is represented by a
parallelogram.
Process box This box is used to show actions in the
process like addition, subtraction etc. It is
represented by a rectangle.
Class-7
Decision box This box is used to test conditions.
It is represented by a diamond shape.
Flow lines Flow lines are used to connect one box of
flow chart to another.
Connector This is used when the flowchart
continues at another place or on another
page. It is represented by a circle.
Example: To create an algorithm and a flowchart to print numbers 1 to 20.
Algorithm:
Step 1: Initialize X as 0
Step 2: Increment X by 1
Step 3 : Print X
Step 4: If X is less than equal to 20 then go back to step 2
Step 5: Stop
Flowchart:
Start
Initialize X=0
Increment X=by 1
Print X
YES
X<20
END
*******