Computer programming:know how to FLOWCHART?
Presented by:
Angelo G. Tomboc
Jonathan H. Llego
FLOWCHARTING
Flowchart is one of the processes used in designing or planning the solution to a problem.
It is a graphical representation to the solution of a problem.
It uses shapes to show instructions and arrow lines and heads to display the flow.
Symbols Used in Flowchar tsPicture Shape Name Action
Represented
Oval Terminal Symbol Represents start and end of the Program
Parallelogram Input/Output Indicates input and output
Rectangle Process This represents processing of action. Example, mathematical
operator
Diamond Decision Since computer only answer the question yes/no, this is used to
represent logical test for the program
Hexagon Initialization/Preparation
This is used to prepare memory for repetition of an action
Arrow Lines & Arrow Heads
Direction This shows the flow of the program
Annotation This is used to describe action or variables
Circle On page connector
This is used to show connector or part of program to another part.
Pentagon Off-page connector
This is used to connect part of a program to another part on other
page or paper
Basic Control Structures at Flowcharting I. Sequence – process which is executed from
one to another in a straightforward manner.
Examples: 1. Design a flowchart that will accept and display a
number. Write its equivalent algorithms.
Start
Print N
Read N
End
Algorithm:Step 1. Read in the value of N.Step 2. Print the value of N.
2. Draw a flowchart that will compute and display the sum and product of two numbers. Write its equivalent.Start
Sum=0Product=0
Read A, B
Sum=A+BProduct=A*B
Print Sum, Product
End
Algorithm:Step 1. Initialize Sum and Product into 0.Step 2. Read in the values of A and B.Step 3. Compute Sum by adding A and B then compute Product by multiplying A and B.Step 4. Print the computed value of Sum and Product.
3. Construct a flowchart that will convert an inputted number in Fahrenheit to its equivalent measure in Celsius.
Start
Celsius=0
Read Fahrenheit
Sum=A+BProduct=A*B
Print Sum, Product
End
Algorithm:Step 1. Initialize Celsius into 0.Step 2. Read in the value of Fahrenheit.Step 3. Compute the computed value of Celsius
II. Selection (If – then – else) – a choice is provided between two alternatives.
C
A
B
T
F
Operators Commonly Used in Flowchar ting
Arithmetic Operations
Logical Operators
Operators Meaning
+ Addition
- Subtraction
* Multiplication
/ Division
Operators Meaning
&& AND
|| OR
! NOT
^_^ USES OF DECISION SYMBOLS ^_^
One of the symbols used in flowcharting in the decision
symbol or the diamond. This symbol requires logical test
that could be determined by using conditional statements
or characters which are listed below. Through logical test,
this symbol provides two answers, if the value evaluated by
the decision symbol produces a true result or if it did not
meet the value on the conditional statement it renders a
“false” value.
1. Draw a flowchart that will input for A and B. Compare two values inputted and print which of the values is higher including the remark “Higher”. Write its equivalent algorithm.
Examples:
Celsius=0
Start
A>B
Print B“Higher”
Print A“Higher”
End
Algorithm:Step 1. Read in the values of A and B.Step 2. Test if A is greater than B.Step 3. If A is greater than B, A is higher. However, if A is less than B, B is higher.Step 4. Print the number and the remark “Higher”.
2. Draw a flowchart that will input a grade of student and determine whether the grade is passed or
failed. Print the name, grade and remarks of student. Write its equivalent algorithm.
Name=“”Remarks=“”
Start
A>B
Read Name, Grade
EndRemarks=“Failed”
Remarks=“Passed”
Print Name, Grade, Remarks
Algorithm:Step 1. Initialize name and remarks into blanks.Step 2. Read in values for Grade and Name.Step 3. Test if Grade is greater than or equal to 60.Step 4. If Grade is greater than or equal to 60, remark is “Passed”. However, if Grade is below 60, remark is “Failed”.Step 5. Print the name, grade, and remarks.
Mathematical Notation
Flowchart Notation
Symbol
= = Equal
<> Not Equal
< < Less Than
> > Greater Than
<= Less than or equal to
>= Greater than or equal to
How to know those mathematical notations that can be conver ted
into f lowchar t notations???
Not Equal The operator is
used to compare if the two values are not equal or show inequality. This is the inverse of equal operator. Syntax of the operator is: “Is Value 1 <> Value 2”.
Start
IsV1<> V2
Process for true value
Process for false value
Yes No
Stop
EnterV1 and V2
V1-represents value 1V2-represents value 2
Less Than The operator used
to test if value1 is less than value2 and vice versa. If value1 is less than value2 it will flow to the “true” side of the decision symbol else(value2 is less than value1) the direction will follow to the “false” side of the decision symbol.
Start
IsV1< V2
Process for true value
Process for false value
Yes No
Stop
EnterV1 and V2
V1-represents value 1V2-represents value 2
More Than The operator used
to test if value1 is more than value2 and vice versa. If value1 is more than value2 it will flow to the “true” side of the decision symbol else (value2 is more than the value hold by value1) the direction will flow to the “false” side of the decision symbol.
Start
IsV1> V2
Process for true value
Process for false value
Yes No
Stop
EnterV1 and V2
V1-represents value 1V2-represents value 2
Less Than Equal The operator is used to
test if the value1 is less than value2. If value1 is less than value2 it will flow to the “true” side of the decision symbol else(value2 is less than value1) the direction will flow to the “false side of the decision symbol. Also, if value1 is equal to value2, the flow of the program will go to the “true” side.
Start
IsV1<=V2
Process for true value
Process for false value
Yes No
Stop
EnterV1 and V2
V1-represents value 1V2-represents value 2
More Than Equal The operator is used
to test if the value1 is more than or equal to the value2. If the value1 is more than or equal to the value2 it will flow to the “true” side of the decision symbol else(value2 is more than the value1) direction will flow to the “false” side of the decision symbol.
Start
IsV1<=V2
Process for true value
Process for false value
Yes No
Stop
EnterV1 and V2
V1-represents value 1V2-represents value 2
ANGEL G. TOMBOC JONATHAN H. LLEGO
Thanks for viewing!!! ^_^All action is reaction....
~Ember Spirit~
Top Related