Chapter 8
Chapter 8
Flowchart Pseudocode
To help programmers plan and write Pseudocode is a way of describing
programs, certain programming tools what happens is a computer
were developed. One such tool is program .It is a list of instruction that
Flow chart. show how the program will work.
A flowchart is a graphical It is the combination of human
representation of programming language and programming
instructions. language.
Symbols
•What is a Flow Chart?
• To help programmers plan and write
programs, certain programming tools were
developed. One such tool is Flow chart.
• A flowchart is a graphical representation of
programming instructions.
Anatomy of Flowchart
• A Flow Chart consists of 2 elements:
• Symbols
• Lines
• Symbols are known as Flowchart Symbols.
• Lines are known as Flowlines.
Anatomy of Flowchart
START
Flowchart Symbols:
• Flow chart symbol shows GET READY
the operation that is carried Flowchart
out in a flowchart. Symbol
GO TO SCHOOL
END
Anatomy of Flowchart
FLOWLINES: START
• We read a flowchart by following the
Flowlines. GET READY
• A flowline represents a connecting
Flowlines
path between flowchart symbols.
GO TO SCHOOL
END
FLOWCHART SYMBOLS
• The most commonly used flowchart
symbols are:
START
INPUT
OUTPUT
PROCESS
DECISION
END
Flowchart Symbol Discussion
START
• The start symbol is oval-
shaped with START written in
the middle. START
• The start symbol shows
where a flowchart begins.
Flowchart Symbol Discussion
PROCESS
• The rectangle used in
flowcharts is the process
symbol.
• It indicates a processing
PROCESS
operation such as a
Calculation or an action in
the flowchart.
Flowchart Symbol Discussion
INPUT
The input symbol is used to
mark the point at which we INPUT
put in data .
OUTPUT
The output symbol is used to
mark the point at which we OUTPUT
get the result.
Flowchart Symbol Discussion
DECISION
There may be a point in our
flowchart where the
flowlines branch out.
At this point we have to YES
DECISION
NO
decide which way to go. ?
In a flowchart ,we use a
diamond-shaped symbol
called Decision symbol.
Flowchart Symbol Discussion
DECISION (Cont.)
• The Decision Symbol is used to indicate a choice or a
branch in a routine.
• There will be a question in the symbol.
• The answer to this question will determine the path to
follow.
• This is the only symbol which has more than one path.
Flowchart Symbol Discussion
END
The end symbol is oval-
shaped with END written in
the middle.
END
The end symbol shows
where a routine ends.
Flowchart Symbol Discussion
Connector:
• Sometimes we can’t write a flowchart
in a same page or column at that time
Connector symbol is used to connect
one portion of a flowchart to another.
Flowchart Symbols
Going to school
START
WAKE UP
GET READY
GO TO
SCHOOL
END
Doing homework
START
DO
HOMEWORK
FINISHED?
NO
YES
END
Playing Football
START
GO TO STADIUM
PLAY FOOTBALL
NO TIME TO
GO HOME ?
YES
END
Washing Clothes
START
WASH CLOTHES
ANY MORE
YES CLOTHES ?
NO
END
Doing a Calculation
START
CALCULATE
22X34
WRITE
ANSWER
END
Pseudocode
• Pseudocode is one of the tools that can be used to
write a preliminary plan that can be developed into a
computer program.
• Pseudocode is a generic way of describing an
algorithm without use of any specific programming
language syntax.
• It is the combination of human language and
programming language.
Variable and Assignment statement
• Variable: a Variable is a storage location.
It is a named data location in a program that can be
changed throughout the execution of a program.
• Constant: A constant is also a storage location. It is a
named location that contains value that we don’t
want to change during the running of the program.
We want the value stored there to remain constant.
Rules for naming variables:
1. All variable names must begin with a letter of the alphabet
2. After the first initial letter, variable names may also contain
letters and the digits 0 to 9. except underscore No spaces or
special characters are allowed.
Tip: Some programmers use underscore in variable names to
separate parts of the name, such as shipping_weight.
Others prefer a "capital style" notation, such as
shippingWeight to separate parts of the name. The name can
be of any length, but don't get carried away. Remember that you
will have to type this name.
3. Uppercase characters are distinct from lowercase characters.
4. Remember that variable names are case-sensitive.
5. You cannot use any keyword ( print,input) for a variable name.
Data Types Description
a whole number, • Integer written as normal in the denary system,
INTEGER e.g. 5, –3
Input a,b,c
sum ← a+b+c
avg ← sum/3
Print avg