We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 5
Chapter 1
FLOWGHARTING
ALGORITHMSCHAPTER 1: FLOWCHARTING AND ALGORITHMS
1.1 Flowchart Defined
“Use of symbols and phrases to designate the logic of how a
problem is solved” (sciives),
= ‘A.common method for defining the logical steps of flow within a
program by using a series of symbols to identify the basic Input,
Process and Output (IPO's) function within a program” (TRAt99)
- “A two-dimensional representation of an algorithm; the
predefined graphic symbols of a flowchart are used to indicate
the various operations and the flow of control” (swazae).
- “A diagram representing the logical sequence in which a
combination of steps or operations is to be performed. It is a
blueprint of the program’ (APU).
4.2 Algorithm Defined
“Algorithm is a finile set of instructions that specify a sequence of
operations to be carried out in order to solve a specific problem or class of
problems” ;swazes).
4.2 Basic Symbols Used in Flowcharting
Symbols. What it represents
[ = Used to signify the beginning and end of
flowchart
Terminal
= Signifies the preparation of data
- Used to select initial conditions
Preparation / Initialization
= Used to represent instructions or group of
instructions that will alter or modify a program's
course of execution.
Flowcharting and Algorithms 2Input / Output
Processing
Decision
On-pagé Connector
Off-page Connector
Flowcharting and Algorithms
“Shows input and output. Dala are to be read
into the computer memory from an input device
or data are to be passed from the memory to
an output device” (swazas),
Performs any calculations that are to be done
Signifies any decisions that are to be done
“Two altemative execution paths are possible.
The path to be followed is selected during the
execution by testing whether or not the
condition specified within the outline is fulfilled”
(Swazs9)
“Shows the entry or exit point of the flowchart’
(swazeo),
“A non-processing symbol used to connect one
part of a flowchart to another without drawing
flowlines” (LAPU8e),
“Conserves space by keeping related blocks
hear one another, reduces the number of
flowlines in complex programs, and eliminates
cross lines from taking place” (LAPUsé).
“Designates entry to or exit from one page
when a flowchart requires more than one
page” (LAPus6).—_ Signifies the process that is to be executed
next
-
Flowtin
1.4 Basic Gontrol Structures.
J. Sequence ~ process is executed from one to another in a straightforward
manner.
Examples:
4. Design a flowchart that will accept and display a number. Write its equivalent
algorithms.
Algorithm:
Step 1, Read in the vaiue of N.
x Step 2. Print the value of N.
ay
Lome /
cen
Flowcharting and Algorith2. Draw a flowchart that will compute and display the sum and product of two
numbers. Write its equivalent algorithm,
Sum =0
Product = 0
‘Sum= A+B »
Product = A*B [~—¥/
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.
Print Sum,
Product
3. Construct a flowchart that will convert an inputted number in Fahrenheit to its
equivalent measure in Celsius.
Formula: C = (5/9) x (F-32)
C=)
Fahrenheit
Celsius = (5/9) * (F-
Flowcharting and Algorithms
Step 1. Initialize Celsius into 0.
Step 2. Read in the value of Fahrenheit.
Step 3. Compute the value of Celsius.
Step 4. Print the computed value of
Celsius.