An Algorithm is a step-by-step method for solving a problem. Its purpose is to break a larger task down so that each step can be carried out without creativity.
It’s a well-ordered collection of unambiguous and effectively commutable operations that produces a result.
It’s a precisely defined and ordered sequence of instructions that is guaranteed to solve a specific problem.
In simple language, an algo is a procedure or formula for solving a problem. It is a well-defined rule or procedure for carrying out some specified task.
Important characteristics of algorithm
There are 5 important characteristics or properties for a well-defined algorithm. These are:-
- Input – One or more values externally supplied to algo
- Output – One or more values are produced by algo.
- Definiteness – Each instruction must be clear and unambiguous.
- Finiteness – Algo must terminate after a finite number of steps.
- Effectiveness – Each instruction must be efficient and feasible.
Problems:-
1) Write an algorithm that performs the addition of two numbers and displays the result of the operation.
Algorithm:
1. START
2. INPUT A,B
3. C=A+B
4. PRINT C
5. STOP
2) Create an algorithm to compute the corresponding area of the circle and print out the area.
Algorithm:
1. START
2. PI=3.14
3. INPUT R
4. AREA= PI*R*R
5. PRINT AREA
6. STOP