You are on page 1of 23

SLIIT ACADEMY

Higher National Diploma in Information


Technology– Year 1, Semester 1

Computer Programming Techniques and Practices

Programming Process-Flow charts

Ruchira ManikkaArachchi

SLIIT Academy Pvt Ltd. © 2020


Learning Outcomes
End of this lecture you will be able to learn ,

LO1:Identify the symbols used to design the flow charts.

LO2:Apply the knowledge to draw the flow charts for the problems.

SLIIT Academy Pvt Ltd. © 2020


What is the Programming Process?

• Every computer program involves several steps to be followed by a


programmer.
• Once the problem has been identified, the logical solution should be
thought out and expressed in a form of a program text such as:
o Pseudo- code
o Flow chart
o Structure chart
o Decision tables and
SLIIT Academy Pvt Ltd. © 2020
decision trees.
Flow Charts

• A symbol-oriented design system that identifies the type of statement by


the shape of the symbol containing the statement.

SLIIT Academy Pvt Ltd. © 2020


Symbols used in Flow Charts: Process Box
This symbol represents an operation that is to be performed. It consists of a
rectangle with one control path leading into it and one leading out.

SLIIT Academy Pvt Ltd. © 2020


Symbols used in Flow Charts: Terminal Symbol
• This oval always begins and ends the flowchart. It can also be used to
indicate the beginning and end of a subsection within the flowchart,
known as a module.
• The terminal symbol will have only one flow line.

BEGIN END

SLIIT Academy Pvt Ltd. © 2020


Symbols used in Flow Charts: Decision Symbol
• This symbol specifies a test operation and consists of the standard
decision box and is characterized by one control path leading in and two
paths leading out.
• The specification P represents a test to be performed. One or the other
output path is taken as a result of the test. True

False
SLIIT Academy Pvt Ltd. © 2020
Symbols used in Flow Charts :Connector Symbol
• This symbol is represented by a circle where control paths lead towards a
common point.
• There are no operations incorporated with this symbol. The symbol is
simply a junction that typically has two entries and one exit.

SLIIT Academy Pvt Ltd. © 2020


Symbols used in Flow Charts: Flow Lines
• These lines represent the passing of control from one of the symbols
(Process Box, Decision symbol, or Connector symbol) to another in the
direction of the arrow.

SLIIT Academy Pvt Ltd. © 2020


Symbols used in Flow Charts: Input/output Symbol
• This parallelogram is used for both input (Read, Get) and output (Write,
Put). So the particular use must be labeled.

READ
Name, Age

SLIIT Academy Pvt Ltd. © 2020


Symbols in Flowchart

Symbols used in Flow Charts

SLIIT Academy Pvt Ltd. © 2020


Practice Question 01
A program is required to read two numbers, add them together and print
their sum.

SLIIT Academy Pvt Ltd. © 2020


Practice Question 01:Answer

BEGIN

int n1,n2,sum=0

PROMPT 'Enter two numbers'

GET n1,n2

sum=n1+n2

PRINT 'The sum of two numbers:', sum

END
SLIIT Academy Pvt Ltd. © 2020
Practice Question 02
Write an Algorithm to read the length and width of a rectangle and state
whether it is a square. (all angles are right angles).

SLIIT Academy Pvt Ltd. © 2020


Practice Question 02:Answer
WRITE ONLY
THE
BEGIN CONDITION

int length, width

PROMPT 'Enter length and width'

GET length, width

IF(length==width) THEN

PRINT 'It is a square'

ENDIF
SLIIT Academy Pvt Ltd. © 2020
END
Practice Question 03
Every day, a weather station receives 15 temperatures expressed in
degrees Fahrenheit. A program is to be written that will accept each
Fahrenheit temperature, convert it to Celsius and display the converted
temperature to the screen. After 15 temperatures have been processed,
the words ‘All temperatures processed’ are to be displayed on the screen.

SLIIT Academy Pvt Ltd. © 2020


Algorithm: Pseudocode
BEGIN
int temp_count=0
float f_temp, c_temp
WHILE (temp_count < 15) DO
PRINT 'Enter Fahrenheit Temperature:'
GET f_temp
c_temp = (f_temp – 32) * 5/9
PRINT 'Celsius Temperature is:', c_temp
temp_count=temp_count+1
ENDWHILE
Print 'All temperatures processed'
END SLIIT Academy Pvt Ltd. © 2020
Flow Chart Sample Answer 01

SLIIT Academy Pvt Ltd. © 2020


Flow Chart Sample Answer 02

Can use a
connector
to reduce
the
complexity

SLIIT Academy Pvt Ltd. © 2020


Advantages of Flowchart
• 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 analyzed 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.
• Proper Debugging: The flowchart helps in debugging process.
SLIIT Academy Pvt Ltd. © 2020
Advantages of Flowchart Cont.….
• Efficient Coding: The flowcharts act as a guide or blueprint during the
systems analysis and program development phase.
• 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.

SLIIT Academy Pvt Ltd. © 2020


Disadvantages of Flowchart
• 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.
SLIIT Academy Pvt Ltd. © 2020
Summary
• What is the Programming Process?
• Flow Charts
• Symbols used in Flow Charts
• Advantages & Disadvantages of Flowcharts

SLIIT Academy Pvt Ltd. © 2020

You might also like