An algorithm is the finite set of sequential
instructions to accomplish a task where instructions
are written in a simple English language.
It is called as a step by step solution of the program.
It is a well developed, organized approach to solving
It refers to logic of program.
It is step by step solution to given program.
4. Characteristics of algorithm
Algorithm has four characteristics:
Finiteness : Total number of steps used in algorithm
should be finite.
Definiteness : Each step of algorithm must be clear
and un ambiguous.
Effectiveness : Every step must be basic and
Input & output: the algorithm must accept zero or
more input and must produce at least one output.
5. How to develop an algorithm
First identify different inputs to be given to system.
Then identify what output you want from the
Then create logic for it.
Break that logic into simple steps.
Write this steps in order.
This forms the algorithm required from the given
6. Advantages Disadvantages
Very easy to write.
Easy technique to
Easy identification of
the mistakes by non
Difficult to show
branching and looping.
Big tasks are difficult to
put in algorithm.
7. Write an algorithm to calculate area of
Step 1: accept value of length i.e l
Step 2: Accept the value of breadth i.e b
Step 3: calculate area. i.e a=l*b
Step 4: print area i.e Print a.
Step 5: stop
8. Create a program to get name and roll
number from user and print it!
Step 1: Initialize name as character and roll number
Step2: Display message “ENTER NAME:” on screen
Step 3: Get name from user
STEP 4: Display message “ENTER R.NO:”
Step 5: Get Roll number from USER
STEP 6: clear the screen
STEP 7: Print name on screen
STEP 8: Print roll number on screen
STEP 9: STOP
9. Write an algorithm to
determine a student’s final grade and
indicate whether it is passing or failing.
The final grade is calculated as the
average of four marks.
Step 1: input a set of 4 marks
Step 2: calculate average of marks
Step 3: if avg <50 then go to next step else go to step
Step 4: print fail.
Step 5: print pass.
Step 6: stop
10. Write a algorithm to find out smallest
number out of two numbers.
Step 1: Accept Two number I.e a,b
Step 2: check if a<b? if yes go to step 3 else go to
Step 3: Print a is smallest number.
Step 4: stop
Step 5: print b is smallest number.
Step 6 : stop
12. What is a flowchart?
It is a pictorial representation of the algorithm.
What we did in algorithm, we can represent it in
This format is easy to understand.
It shows us the flow of the instructions.
13. Symbols of flowchart
Name Symbol Use in flowchart
Oval Used at starting and at
ending of the program.
Flowlines Used to show direction
of the flow.
Parallelogram Used for input output
Rectangle Denotes process to be
14. Symbols of flowchart
Diamond It is used for showing
Round Connecting flow lines
from different places
Block Indicates block of
statements or body of
15. Advantages Disadvantages
Easy to draw.
Easy technique to
Easy to identify the
mistake by non
Easy for branching and
Difficult for modification.
Difficult task to draw
flow charts for big
16. Different operators used in programing
Determine how one value relates to another
Equal to ==
Not equal to !=
Less than <
Greater than >
Less than or Equal to <=
Greater than or Equal to >=
28. Example : write an algorithm and flowchart for
converting length in feet to centimeter.
Step1: input l in ft
Step 2: L in cm= l in ft*30
Step 3: Print l in cm.
value of l
L in cm= l in ft*30
Print l in cm
29. Example: write an algorithm and flowchart to
read 2 sides of rectangle and calc. its area.
Step1: read input W,L.
Step3: print A
value of W
A= L*W;A = L * W