Module 3 - 2 Flowchart

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 18

CMPRG

Computer Programming

FLOWCHART
Flow Charts
Algorithm for large problems becomes complex
and thereby difficult to write the code. Problem
analysts found ‘Flow charts’

• an easier way to solve the problem.


• each step is represented by a symbol and
contains a short description of the process steps
within the symbol.
• Flow charts are linked by arrows.
• Other names of flow chart are flow diagram,
process chart, and business flow diagram etc.,.
Flow Charts

Flow charts can be used for the following


aspects

• Define and analyze


• Build step by step picture of a process
• To find the areas of improvement in the
process
Flow Charts Advantages

• Communication – it is better way of


communicating the logic of a program solution

• Effect analysis – with the help of flow charts


problem can be analyze in a effective way

• Effective coding – flow charts acts as a blue


print during the system analysis iv. Proper
debugging – flow chart helps in debugging
process.
Flow Charts Limitations

• Alterations and modifications:


If alterations are required, the flowchart may
require re-drawing completely.  
Types of Flow Charts

System flow charts


• used by system analyst to describe the
data flow and operation in a data
processing cycle

• defines the broad processing in


organizations showing the origin of data
filing structure, processing to be performed
and output to be generated.
Types of Flow Charts

Program flow charts:


• are used by programmers.
• used to describe the sequence of
operations and decisions for a particular
problem. Generally to solve any of the
programs belonging to C, C++, Java. .
etc., program flow charts are used.
Symbols used in Flow Charts

The flow chart being a symbolic


representation, standard symbols is used for
each specific operation.

These symbols are used to represent the


sequence of operations and flow of data and
documents required for programming. Flow
should be from top to bottom.
Symbols used in Flow Charts

Start or end of the program


Computational steps or processing function of program
Input or output operation
Initialization
Decision making and branching
On-page connector
Off-page connector
Subroutine
Database
Document printout
Writing Expressions in
Computer Language
1. To read the input ;
The following symbol is used to read one
or more inputs.  

Read a
Here ‘a’ is the variable where the value of
Input is stored
Writing Expressions in
Computer Language

2. To produce output :
The following symbol is used to print one or
more outputs.

Print a

Here ‘a’ is the variable where the value of


Output is stored.
Writing Expressions in
Computer Language
3. Assignment operator
The result of arithmetic operation is stored
in a variable.  
– Let a and b be inputs
– Operation  addition
– Result is stored in variable c
Writing Expressions in
Computer Language
Start

Read a,b

c=a+b

Stop

Example of Assignment operator.


Examples:
Flow Charts
1. Draw a flowchart to find greater of 2
numbers
Start

Read a, b

Yes No
Is a < b

Print a Print ab

Stop
Examples:
Flow Charts
2. Fahrenheit Scale Start
Convert into Celsius
Scale Read FARH

Solution:
Formula: C = (F-32)/1.8 CENTI = (FARH-32) / 1.8

where F is Fahrenheit
value and C is Celsius Print CENTI
value.

Stop
Examples:
Flow Charts
3. Draw a flowchart calculating
the area of a triangle with the
length of the three sides as a, b,
c, given by A=where s is the
semi-perimeter of the triangle,.
The perimeter of the triangle is
given by P = a+b+c.
Examples:
Flow Charts
4. Write a flowchart to
add natural numbers
from 1 to 50
Examples:
Flow Charts
Start

5. Draw a flowchart that Initialize

add first N numbers


Sum = 0
A=1

Read N

Sum = Sum + A

No Is count
A =A + 1 A = N?

Print Sum

Stop

You might also like