Algorithm:
An algorithm is a description of a procedure which terminates with a result. Algorithm is a step-
by-step method of solving a problem.
Properties of an Algorithm:
1) Finiteness: - An algorithm terminates after a finite numbers of steps.
2) Definiteness: - Each step in algorithm is unambiguous. This means that the action specified by
the step cannot be interpreted (explain the meaning of) in multiple ways & can be performed
without any confusion.
3) Input: - An algorithm accepts zero or more inputs
4) Output:- An algorithm should produce at least one output.
5) Effectiveness: - It consists of basic instructions that are realizable. This means that the
instructions can be performed by using the given inputs in a finite amount of time.
Writing an algorithm
An algorithm can be written in English, like sentences and using mathematical
formulas. Sometimes algorithm written in English like language is Pseudo code.
Examples
1) Finding the average of three numbers
1. Let a,b,c are three integers
2. Let d is float
3. Display the message “Enter any three integers:”
4. Read three integers and stores in a,b,c
5. Compute the d = (a+b+c)/3.0
6. Display “The avg is:” , d
7. End.
TAHSINA MUTHAKI 1
Flowcharts :
The pictorial representation of an algorithm is called a flowchart.
Uses of a flow chart:
1: A flow chart helps to understand the program easily.
2: As different symbols are used to specify the type of operation performed, it is easier to
understand the complex programs with the help of flowcharts.
S.No Description Symbols
1 Flowlines: Shows the flow of control through the
program from left to right or top to bottom.
2 Terminal Symbol: Oval-shaped symbol that marks
the start and end of a flowchart.
3 Input/Output Symbol: Parallelogram used for input
(read) or output (write) actions in a program.
4 Process Symbol: Rectangle used for calculations or
initializing memory locations.
5 Decision Symbol: Diamond-shaped symbol used for
decision-making, with "Yes" and "No" exits.
6 Connector: Circle used to connect flowcharts across
multiple pages or sections.
TAHSINA MUTHAKI 2
TAHSINA MUTHAKI 3