Beruflich Dokumente
Kultur Dokumente
Laboratory Exercise # 1
Score
Laboratory Exercise # 1
Objectives:
At the end of this laboratory, you are expected to understand the
importance of algorithm, pseudocode, and flowchart in computer programming.
Also, you are expected to design your algorithm, pseudocode, and flowchart
based on the given situation and criteria.
Materials
Laboratory manual
Introduction
The algorithm is a step by step method of solving a problem. It is commonly
used for data processing, calculation, and other related computer and
mathematical operations. An algorithm is also used to manipulate data in various
ways, such as inserting a new data item, searching for a particular item or sorting
an item.
Sample Algorithm:
The algorithm in finding the perimeter and area of a rectangle is
1. Get the length of the rectangle.
2. Get the width of the rectangle.
3. Find the perimeter using the following equation:
Perimeter =2*(length + width)
4. Find the area using the following equation:
Area = length * width
5. Display results.
Pseudocode is an informal program description that does not contain code syntax
or underlying technology considerations. It summarizes the program flow but
excludes underlying programming details.
Example:
Begin
input length, width
perimeter = 2 * (length + width)
area = length * width
print perimeter
print area
End
A flowchart is a graphical representation of an algorithm. It is usually drawn using
certain special-purpose symbols connected by arrows called flow lines. Table 1.1
shows the basic flowchart symbols with its equivalent meaning.
Terminal
Input/output operation
Process
Initialization
Pre-defined process
Off-page connector
On page connector
Decision
Flow lines
Operator Description
== equal to
!= not equal to
< less than
<= less than or equal to
> greater than
>= greater than or equal to
Table 1.2 Relational Operators
Operator Description
! not
&& and
|| or
Table 1.3 Logical Operators
Pseudocode Flowchart
Begin
initialize x and y
input x and y
sum = x+y
print sum
End
Pseudocode Flowchart
Begin
input select
if select == 1
print ̏Balance Inquiry”
goto a
if select == 2
print ̏withdrawal”
goto b
if select == 3
print ̏Exit”
goto c
End
Pseudocode Flowchart
Begin
i=0
sum = 0
while i<10
input x
sum = sum +x
++i
avg = sum / 10
print avg
End
Start
End
2. How many decision boxes needed in implementing the flowchart based on
the given pseudocode?
Answer:
It had 3 decision boxes needed in implementing the flowchart.
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
Design a pseudocode and flowchart that will accept the evaluation score of a
faculty and determine its equivalent remarks. Remarks are based on the following
criteria:
Begin
Input name of faculty, evaluation score of faculty.
Score>=4.5
0 Remark is “Outstanding”
Score>=4.0
Remark is “Very Satisfactory”
0 Display Faculty name,
Score, Remark
Ratings
Parameters
3 2 1
Specifications Contains the complete Lacks one-three details Lacks more than three
(30%) details to the given to the given task. details to the given
task. (20) task.
(30) (10)
________________________
Signature of Subject Teacher