Lab1 Introduction To Algorithm Part1!1!20232024
Lab1 Introduction To Algorithm Part1!1!20232024
1 / 12
1.1. Understand the basic symbols of flow charts and method of pseudocode
1.2. Identify the Pseudocode and flow charts.
1.3. Create the Pseudocode and flow charts.
2. INTRODUCTION / THEORY
a. Terminal
The terminal symbol, as the name implies, is used to indicate the starting (BEGIN),
stopping
(END), and pause (HALT) in the program logic flow. It is the first symbol and the last
symbol in the program logic. In addition, if the program logic calls for a pause in the
program, that also is indicated with a terminal symbol. A pause is normally used in
the program logic under some error conditions or in case the forms had to be
changed in the computer’s line printer during the processing of that program.
b. Input/Output
Faculty of Engineering Technology Page No. 3 / 12
c. Processing
d. Flow lines
Flowlines with arrowheads are used to indicate the flow of operation, that is, the exact
sequence in which the instructions are to be executed. The normal flow of flowchart is from
top to bottom and left to right. Arrowheads are required only when the normal top to
bottom flow is not to be followed. However, as a good practice and in order to avoid
confusion, flow lines are usually drawn with an arrowhead at the point of entry to a symbol.
Good practice also dictates that flow lines should not cross each other and that such
intersections should be avoided whenever possible.
Faculty of Engineering Technology Page No. 4 / 12
The decision symbol is used in a flowchart to indicate a point at which a decision has to be
made and a branch to one of two or more alternative points is possible. Figure 1.2 shows
three different ways in which a decision symbol can be used. It may be noted from these
examples that the criterion for making the decision should be indicated clearly within the
decision box. Moreover, the condition upon which each of the possible exit paths will be
executed, should be identified and all the possible paths should be accounted for. During
execution, the appropriate path is followed depending upon the result of the decision.
f. Connector
If a flowchart becomes very long, the flow lines start crisscrossing at many places that
causes confusion and reduces the clarity of the flowchart. Moreover, there are instances
when a flowchart becomes too long to fit in a single page and the use of flow lines becomes
impossible. Thus, whenever a flowchart becomes too complex that the number and
direction of flow lines is confusing or it spreads over more than one page, it is useful to
utilize the connector symbol as a substitute for flow lines. This symbol represents an entry
from, or an exit to another part of the flowchart. A connector symbol is represented by a
circle and a letter or digit is placed within the circle to indicate the link. A pair of identically
labeled connector symbols is commonly used to indicate a continued flow when the use of a
line is confusing. So two connectors with identical labels serve the same function as a long
flow line. That is, they show an exit to some other chart section, or they indicate an entry
from another part of the chart. How is it possible to determine if a connector is used as an
entry or an exit point? It is very simple: if an arrow enters but does not leave a connector, it
Faculty of Engineering Technology Page No. 5 / 12
2.3. Pseudocode
Pseudocode is a language very close to English that allows us to represent a program concisely.
The only thing you need is a statement to show where you are starting and where you are
ending a program. We will be using the word Start for the start point and the word End to show
the finish point. Each program will contain statements to accomplish our goal; this will satisfy
step 3 from Chapter 1. Rules for Pseudocode are:
a. Write only one statement per line
b. Capitalize initial keyword
c. Indent to show hierarchy
d. End multiline structures
e. Keep statements language independent
Faculty of Engineering Technology Page No. 6 / 12
3. EQUIPMENT / REQUIREMENT
4 PROCEDURES (TASKS)
4.1.1 Please create the pseudocode for a program that can adding (total) and averaging (AVG) two
number (X and Y) which are received from input. Then, the total and average are displayed.
(5 marks)
4.1.2Please convert the pseudocode in task 4.1.1 into the flowchart.
(10 marks)
Faculty of Engineering Technology Page No. 7 / 12
4.2.1 Please create the pseudocode for a program that are able to measure or sense the car speed in
miles per hour (mph), and then, convert the speed in miles into kilometers per hour (km/h). The
program also display the speed in kmh. If the driver exceed the speed limit of 70kmh, program will
warn the driver through dislay with the message ‘PLEASE REDUCE SPEED’.
(5 marks)
4.2.2 Please convert the pseudocode in task 4.2.1 into the flowchart.
(10 marks)
Faculty of Engineering Technology Page No. 8 / 12
4.3.1 Please create the pseudocode for a program that can adding and averaging five numbers (A,B,C,D
and E) which are received from input. Then, display the total (TOTAL) and average (AVE).
(5 marks)
4.3.2 Please convert the pseudocode in task 4.3.1 into the flowchart.
(10 marks)
Faculty of Engineering Technology Page No. 9 / 12
4.4 From the flowchart given, please convert into the pseudocode.
4.4.1 Insert and total for 2 numbers and display the total. (5 marks)
4.4.2 Insert, total and average for 4 input numbers and selection the set average to display the result.
(10 marks)
Faculty of Engineering Technology Page No. 10 / 12
5. DISCUSSION
(10 marks)
-Not visual
-No accepted standard
-Varies from company to company
(10 marks)
Faculty of Engineering Technology Page No. 12 / 12
6. CONCLUSION
Algorithms are the rule and sequences made to understand thing and flowchart is the
Diagrammatic representation of the same. A flowchart visualizes an algorithm for a
Non-technical view while a pseudocode outlines the algorithm’s key principles in a
Linear presentation
(5 marks)