ALGORITHM AND FLOWCHART
ES1101
ALGORITHM
• The sequence of steps to be performed in order to solve a problem by the computer is
known as an algorithm.
• Algorithm : Systematic logical approach which is a well-defined, step-by-step procedure
that allows a computer to solve a problem.
• Pseudocode : It is a simpler version of a programming code in plain English which uses
short phrases to write code for a program before it is implemented in a specific programming
language.
• Program : It is exact code written for problem following all the rules of the
programming language.
A mathematician, philosopher, inventor
and mechanical engineer, Babbage
originated the concept of a digital
programmable computer
FLOWCHART
• Flowchart is a graphical or symbolic representation of an algorithm. It is the
diagrammatic representation of the step-by-step solution to a given problem.
Consider that we need to find the sum, average and product of 3 numbers given by the user.
Algorithm for the given problem is as follows:
1. START
2. Read X,Y, Z
3. Compute Sum (S) as X + Y + Z
4. Compute Average (A) as S / 3
5. Compute Product (P) as X * Y * Z
6. END
SYMBOL 1
Terminator: An oval flow chart shape indicates the start or end of the process,
usually containing the word “Start” or “End”.
TERMINATOR
SYMBOL 2
• Data: A parallelogram that indicates data input or output (I/O) for a process.
Examples: Get X from the user, Display X.
INPUT/
OUTPUT
SYMBOL 3
Process: A rectangular flow chart shape indicates a normal/generic process flow
step. For example, “Add 1 to X”, “M = M*F” or similar
PROCESS
SYMBOL 4
• Decision: A diamond flow chart shape indicates a branch in the process flow.
This symbol is used when a decision needs to be made, commonly a Yes/No question or
True/False test.
DECISION
SYMBOL 5
• Connector: A small, labelled, circular flow chart shape used to indicate a jump
in the process flow. Connectors are generally used in complex or multi-sheet diagrams.
SYMBOL 6
• Delay: used to indicate a delay or wait in the process for input from some other
process.
DELAY
SYMBOL 7
• Arrow: used to show the flow of control in a process. An arrow coming from
one symbol and ending at another symbol represents that control passes to the symbol
the arrow points to.
A flowchart is read from LEFT to RIGHT or TOP to BOTTOM
CONSIDER ANOTHER PROBLEM OF FINDING THE LARGEST
NUMBER BETWEEN A AND B
Algorithm
1. Read A, B
2. If A is less than B
BIG=B
SMALL = A
3. Else
BIG=A
SMALL = B
4. Write (Display) BIG, SMALL
FIND THE LARGEST NUMBER BETWEEN A, B AND C
ALGORITHM TO FIND ROOTS OF A QUADRATIC EQUATION
Sum of 5 numbers
Print Hello World 10 times
Draw a flowchart to log in to facebook account
•Note!
As there are many ways to solve a given
problem so there are many ways to
draw a flowchart.
ADVANTAGES OF USING FLOWCHARTS
• Communication: Flowcharts are better way of communicating the logic of a system to all
concerned.
• Effective analysis:With the help of flowchart, problem can be analysed in more effective way.
• Proper documentation: Program flowcharts serve as a good program documentation, which is
needed for various purposes.
• Efficient Coding:The flowcharts act as a guide or blueprint during the systems analysis and
program development phase.
• Proper Debugging:The flowchart helps in debugging process.
• Efficient Program Maintenance:The maintenance of operating program becomes easy with
the help of flowchart. It helps the programmer to put efforts more efficiently on that part.
LIMITATIONS OF USING FLOWCHARTS
• Complex logic: Sometimes, the program logic is quite complicated. In that case, flowchart
becomes complex and clumsy.
• Alterations and Modifications: If alterations are required the flowchart may require re-
drawing completely.
RAPTOR TOOL TO DRAW FLOWCHARTS
• [Link]
PRACTICE A FLOWCHART HERE
• [Link]
FOR RAPTOR TUTORIAL
GOTO HELP GENERAL HELP
OR JUST PRESS F1
HERE CLICK ON RAPTOR TUTORIAL AND STUDY HOW TO CREATE A FLOWCHART
THANK YOU