It is step by step procedure to solve any problem.
Characteristics of an algorithm:
- All the steps of an algorithm must be executed in sequence to obtain the output.
- An algorithm must terminate after a finite number of steps.
- It may take zero or more inputs.
- It must give at least one output.
Algo: Find area and perimeter of square
- Start/Begin
- Enter side of square
- perimeter = 4*side
- area = side*side
- Print perimeter
- Print area
- Stop/End
Algo- Find area and perimeter of rectangle
- Start/Begin
- Enterlength and breadth as l & b of rectangle
- perimeter = 2*(l+b)
- area = l*b
- Print perimeter
- Print area
- Stop/End
Algo- Find total & percentage of a student based on marks in five subjects
- Start/Begin
- Enter marks in five subjects as m1,m2, m3, m4, m5
- Total = m1+m2+m3+m4+m5
- Percentage = Total/5
- Print total
- Print percentage
- Stop/Exit