·
Algorithm
-
An algorithm
is a finite set of instruction for solving a particular problem step by step.
-
It is common
to all programming language.
-
Each and every
instruction should be clear and precise.
-
After performing
instruction, the desired result must be obtained.
-
In first step
start with start mark and end with stop mark.
Example :- Algorithm to find simple Interest
Step 1 : Start
Step 2 : Input principle,
time and rate in variable p, t, r
Step 3 : Calculate simple interest
(p * t * r) / 100 and store it in variable SI
Step 4 : Print the value of
SI
Step 5 : Stop
Example :- Algorithm to add two number
Step 1 : Start
Step 2 : Input two number in
variable a, b
Step 3 : Calculate addition
of two number c = a + b and store it in
variable c
Step 4 : Print value of sum
in variable c
Step 5 : Stop
Example :-
Step 1 : Start
Step 2 : Initialize a
variable I to 1
Step 3 : Input the value for
N
Step 4 : While I is less
than or equal to N do the following steps.
a. Print I
b. I = I + 2
Step 5 : Stop
Example :- Algorithm to find area of circle
Step 1 : Start
Step 2 : Input radius of
circle in variable r
Step 3 : Calculate area of
circle a = 22 / 7 * r ^ 2 store it in variable a
Step 4 : Print area of
circle a
Step 5 : Stop
Example :- Algorithm to find perimeter of Triangle
Step 1 : Start
Step 2 : Input three sides
of triangle and store in variable s, b, s
Step 3 : Calculate perimeter
of triangle p = s + b + s and store it in variable p
Step 4 : Print perimeter of
triangle p
Step 5 : Stop
·
Flowchart
-
Flow Chart is
a pictorial or graphical representation of algorithm.
-
It uses some symbol
for different purposes.
-
It is easy to
understand as algorithm.
Symbols used in flow chart’s :-
a. Rounded Corner Box or Oval Shape :- It is used to
start and stop of the flow chart.
b. Input / Output Box :- It uses parallelogram. It uses
for Input and Output in flow chart.
c. Processing Box :- It uses Rectangular shape. It
used for processing assignment in flow chart.
d. Decision Box :- It uses Diamond Symbol. It used
for decision making i.e. a > b.
e. Root maker arrow symbol : -
f. Connector :- It uses for connecting shape with
arrow. It uses for connecting other part of flow chart.
·
Rules for
preparing Flow Chart
-
It must have a
logical start and finish.
-
All necessary
requirement should be listed in logical order.
-
All symbol
must connected with arrow.
-
Only one line
should come from process box.
-
Only one line
should enter in decision box but two or three line may come out.
-
Only one line
is used with the terminal symbol.
Example :- Input value of radius and calculate area of
circle using flow chart.
Example :- Input two number
and choose which one is greater in flow chart.
0 Comments
Thank You ! For your love