Algorithms and Flowcharts
Algorithm: An algorithm is defined as
sequence of steps to solve a problem (task). The
steps must be finite, well defined and
unambiguous. Writing algorithm requires some
thinking. Algorithm can also be defined as a plan
to solve a problem and represents its logic. Note
that an algorithm is of no use if it does not help
us arrive at the desired solution
Algorithm characteristics
1. It should have finite number of steps. No one
can be expected to execute infinite number
of steps.
2. The steps must be in order and simple
3. Each step should be defined clearly i.e.
without un-ambiguity (without doubtfulness)
4. Must include all required information
5. Should exhibit at least one output
Flowchart
A flowchart is a pictorial (graphical)
representation of an algorithm. A flowchart is
drawn using different kinds of symbols. A symbol
is used for a specific purpose. Each symbol has
name.
• Different algorithms have different performance
characteristics to solve the same problem. Some algorithms
are fast. Some are slow. Some occupy more memory space.
Some occupy less memory space. Some are complex and
some algorithms are simple.
• Logically algorithm, flowchart and program are the same.
Q1. Create a program to compute the volume of a sphere. Use
the formula: V = (4/3) *pi*r3 where pi is equal to 3.1416
approximately. The r is the radius of sphere. Display the result.
• Q2. Write a program the converts the input
Celsius degree into its equivalent Fahrenheit
degree. Use the formula: F = (9/5) *C+32.