0% found this document useful (0 votes)
16 views

Flowcharts

Uploaded by

Maniacal Danger
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Flowcharts

Uploaded by

Maniacal Danger
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

FLOWCHARTS

Dr. Prasenjit Choudhury


&
Rajib kumar Chatterjee
Dept. of Computer Science and Engineering
National Institute of Technology, Durgapur
West Bengal, India
CONTENTS

• FLOWCHARTS
• SYMBOLS USED TO DRAW FLOWCHARTS
• FLOWCHARTS VS ALGORITHMS
• FLOWCHARTS VS PSEUDO CODE
• EXAMPLES
• ADVANTAGES AND DISADVANTAGES OF
FLOWCHARTS
FLOWCHARTS
• What is a Flowchart?
• Flowchart is a graphical representation of an algorithm.
• A flowchart is a schematic representation of an algorithm or a stepwise
process, showing the steps as boxes of various kinds, and their order by
connecting these with arrows.
• Flowcharts are used in designing or documenting a process or program.
• A flow chart, or flow diagram, is a graphical representation of a process or
system that details the sequencing of steps required to create output.
• A flowchart is a picture of the separate steps of a process in sequential order.
• Programmers often use it as a program-planning tool to solve a problem.
• It makes use of symbols which are connected among them to indicate the flow
of information and processing.
• The process of drawing a flowchart for an algorithm is known as
“flowcharting”.
FLOWCHARTS contd…..
• 4 Most Common Flowchart Types
• The Process Flowchart. Illustrate How a Process Works or Plan a
Project. ...
• The Workflow Chart Understand How Data and Documents Flow
Within Your Organization. ...
• The Swimlane Flowchart Describe How Separate Departments,
Processes or Employees Interact. ...
• The Data Flowchart.
• GUIDELINES FOR DRAWING A FLOWCHART
• Flowcharts are usually drawn using some standard symbols however,
some special symbols can also be developed when required. Some
standard symbols, which are frequently required for flowcharting
many computer programs.
Basic Symbols used in Flowchart Designs
1. Terminal: The oval symbol indicates Start, Stop and Halt in a program’s logic flow. A pause/halt is generally used
in a program logic under some error conditions. Terminal is the first and last symbols in the flowchart.

2. Input/Output: A parallelogram denotes any function of input/output type. Program instructions that take input
from input devices and display output on output devices are indicated with parallelogram in a flowchart.

3. Processing: A box represents arithmetic instructions. All arithmetic processes such as adding, subtracting,
multiplication and division are indicated by action or process symbol.

4. Decision Diamond symbol represents a decision point. Decision based operations such as yes/no question or
true/false are indicated by diamond in flowchart.

5. Connectors: Whenever flowchart becomes complex or it spreads over more than one page, it is useful to use
connectors to avoid any confusions. It is represented by a circle.

6. Flow lines: Flow lines indicate the exact sequence in which instructions are executed. Arrows represent the
direction of flow of control and relationship among different symbols of flowchart.
Basic Symbols used in Flowchart Designs
FLOWCHART VS ALGORITHM
FLOWCHART ALGORITHM
• Powerful tool for programming. • Powerful tool for programming.
• Helps to clarify all the steps for solving • Helps to clarify all the steps for solving the
problem.
the problem.
• Each step in the algorithm should be clear
• A flowchart explains the steps of a and unambiguous and Input and output
program in a graphical way. should be defined precisely.
• Flowchart is a diagram created by • An algorithm shouldn't include computer
code. Instead, the algorithm should be
different shapes to show the flow of written in such a way that it can be used in
data. different programming languages.
• A flowchart is a blueprint that pictorially • An algorithm is a step-by-step procedure for
represents the algorithm and its steps. analysis of the problem and solve it.
• In algorithm plain text are used and hence it
• Flowchart is simple to construct and hard is easy to debug.
to debug • Algorithm does not follow any rules and
• The steps of a flowchart do not have a hence is difficult to construct.
specific size and shape rather it is • Algorithm is the pseudo code for the
designed in different shapes and sizes. program.
FLOWCHART VS ALGORITHM (EXAMPLES)
FLOWCHART ALGORITHM
Example: Flowchart for sum of two numbers
• Algorithm to add two numbers
entered by the user
• Step 1: Start
• Step 2: Declare variables num1,
num2 and sum.
• Step 3: Read values num1 and num2.
• Step 4: Add num1 and num2 and
assign the result to sum.
• sum←num1+num2
• Step 5: Display sum
• Step 6: Stop
FLOWCHART VS PSEUDO CODE
FLOWCHART PSEUDO CODE
• The level of expressiveness of Flowcharts are • Pseudo codes have the same level of
same as pseudo code. expressiveness as Flowcharts.
• A flowchart is not linear • Pseudocode is linear (i.e. a sequence of lines with
instructions).
• Flowcharts are at a higher abstraction
level. • Flowcharts are used before writing pseudocode
or for documentation.
• Flowchart is a pictorial representation of an
algorithm. • Pseudocode is an informal high-level description
of an algorithm.
• Flowcharts are capable of showing the
overall flow of instruction and data from one • Pseudocode is very much similar to the final
process to another. We can get the main program code. It requires less time, precision and
concept of the whole program at just on space.
glance • The beauty of pseudocode is that even if there are
• Flowchart is the graphical representation of some common pseudocode notations, it can be
algorithm. written in ones own way with no fixed rules.
• Pseudocode is the logical(program-like)
representation of algorithm
FLOWCHART VS PSEUDOCODE (EXAMPLES)
FLOWCHART EXAMPLE PSEUDO CODE EXAMPLE
• Pseudocode to Check Whether
Number is Odd or Even
0. Start
1. Print "Enter Any Number to Check,
Even or Odd"
2. Read input of a number inn A
3. if A is >=0
4. If number mod 2 = 0
5. Print "Number is Even"
6. Else
7. Print "Number is Odd"
8. Else Print “enter positive number”
9. End
EXAMPLE OF FLOWCHART (1)
• EXAMPLE NO : 1 Flowchart to Add two numbers
EXAMPLE OF FLOWCHART (2)
Algorithm to find the largest of three numbers Flowchart to find the largest of three numbers
• Algorithm : 1

• Step 1 : Start
• Step 2 : Input a, b, c
• Step 3 : if a > b goto step 4, otherwise goto step 5
• Step 4 : if a > c goto step 6, otherwise goto step 8
• Step 5 : if b > c goto step 7, otherwise goto step 8
• Step 6 : Output "a is the largest", goto step 9
• Step 7 : Output "b is the largest", goto step 9
• Step 8 : Output " c is the largest", goto step 9
• Step 9 : Stop
EXAMPLE OF FLOWCHART (2) contd…
Algorithm to find the largest of three numbers Flowchart to find the largest of three numbers

• Algorithm : 2

• Step 1 : Start
• Step 2 : Input A, B, C
• Step 3 : Let max = A
• Step 4 : if B > max then max = B
• Step : if C > max then max = C
• Step 6 : Output max is largest
• Step 7 : Stop
EXAMPLE OF FLOWCHART (3)
ALGORITHM to find the factorial of a number FLOWCHART to find the factorial of a number

• Algorithm

• Step 1 : Start
• Step 2 : Read n
• Step 3 : Initialize counter variable i to 1
and fact to 1
• Step 4 : if i <= n go to step 5 otherwise
goto step 7
• Step 5 : calculate fact = fact * i
• Step 6 : increment counter variable i and
goto step 4
• Step 7 : Write fact.
• Step 8 : Stop
EXAMPLE OF FLOWCHART (4)
ALGORITHM to swap two numbers FLOWCHART to swap two numbers
• Algorithm (using a third variable)

• Step 1 : Start
• Step 2 : READ num1, num2
• Step 3 : temp = num1
• Step 4 : num1 = num2
• Step 5 : num2 = temp
• Step 6 : PRINT num1, num2
• Step 7 : Stop
ADVANTAGES OF FLOWCHARTS
• Communication: Flowcharts are better way of communicating the logic of a
system to all concerned or involved.
• Effective analysis: With the help of flowchart, problem can be analysed in more
effective way therefore reducing cost and wastage of time.
• Proper documentation: Program flowcharts serve as a good program
documentation, which is needed for various purposes, making things more efficient.
• 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
DISADVANTAGES OF FLOWCHARTS

• Complex logic: Sometimes, the program logic is quite


complicated. In that case, flowchart becomes complex and
clumsy. This will become a pain for the user, resulting in a
waste of time and money trying to correct the problem
• Alterations and Modifications: If alterations are required the
flowchart may require re-drawing completely. This will usually
waste valuable time.
• Reproduction: As the flowchart symbols cannot be typed,
reproduction of flowchart becomes a problem.
Thank You

You might also like