Computer Pseudo Codes and Flow Charts Algorithm
Computer Pseudo Codes and Flow Charts Algorithm
Computer Pseudo Codes and Flow Charts Algorithm
LESSON 1 PAGE 1
COMPUTER PSEUDO CODES AND FLOW CHARTS
INTRODUCTION
Algorithm
An algorithm is a procedure or formula for solving a problem.
Often used for calculation, data processing and programming
Pseudo code
A pseudo code is an English like representation of
logical steps it takes to solve a problem (List of steps
written in English)
Begins and ends with terminals (start and stop)
Each step represents an activity (input, process, decision
and output)
No punctuations at the end of the statements
Statements are indented but terminals are lined
From here connect to page 2
1
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
2
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
FLOWCHART PAGE 4
A flowchart is a graphical representation of an algorithm.
It is a diagram made up of shapes connected by arrows.
Each shape represents a step in the process, and the
arrows show the order in which they occur.
General Rules for flowcharting
a. All boxes of the flowchart are connected with Arrows. (Not
lines)
b. Flowchart symbols have an entry point on the top of the
symbol with no other entry points.
c. The exit point for all flowchart symbols is on the bottom
except for the Decision symbol.
d. The Decision symbol has two exit points; these can be on
the sides or the bottom and one side.
e. Generally a flowchart will flow from top to bottom.
From here connect to page 5
FLOW CHART SYMBOLS AND FUNCTIONS page 5
3
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
4
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
5
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
END OF LESSON 1
6
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
LESSON 2 PAGE 1
COMPUTER PSEUDO CODES AND FLOW CHARTS
Operations and meanings used in flow charts
7
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
QUESTIONS PAGE 2
1. Write a pseudo code for calculating an average of three
numbers.
2. Write a flow chart for the pseudo code you wrote in
question 1
3. Write a pseudo code that inputs two numbers (a and b)
and output the largest number.
4. Write a flow chart for the pseudo code you wrote in
question 3
Copy the question above, scroll down for answers and listen to
possible audios following each answer page
SOLUTION 1 PAGE 3
TASK: FINDING AVERAGE OF THREE NUMBERS
PSUEDO CODE
Start
Select numbers of X, Y, Z
S=X+Y+Z
A = S/3
Write value of A
Stop
From here connect to page 4
8
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
SOLUTION 2 PAGE 4
SOLUTION 3 PAGE 5
TASK: TWO NUMBERS OUTPUTTING A LAGER NUMBER
Start
INPUT a
INPUT b
IF a < b THEN
OUTPUT b
ELSE
OUTPUT a
Stop
From here connect to page 6
9
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
SOLUTION 4 PAGE 6
END OF LESSON 2
10
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
LESSON 3 PAGE 1
COMPUTER PSEUDO CODES AND FLOW CHARTS
1. Given that a right angled triangle has height and base .
a. Come up with a pseudo code for calculating area of this
triangle.
b. Draw a complete flow chart for the calculation of area.
2. The tax threshold for government employees is K2, 000 for
the tax rate of 0.1%.
a. Create a pseudo code for this threshold.
b. Draw a complete flow chart for this threshold.
c. Calculate the tax for
i. Income of K1, 850
ii. Income of K2, 700
Copy the question above, scroll down for answers and listen to
possible audios following each answer page
11
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
SOLUTION 1 a. PAGE 2
TASK: CACULATING AREA OF A RIGHT ANGLED TRIANGLE
Pseudo code
o Start
o Input b, h
o Calculate area
o Output area
o End
SOLUTION 1 b. PAGE 3
12
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
SOLUTION 2 a PAGE 4
TASK: CALCULATE TAX THRESHOLD
Pseudo code
o Start
o Input Income
TAX 0
ELSE
CALCULATE TAX
o Print tax
o End
13
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
SOLUTION 2 b. PAGE 5
14
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
SOLUTION 2 c. i. PAGE 6
Income = 1 850
In this case, yes income is less than 2000
SOLUTION 2 c. ii
Income = 2700
End of lesson 3
15
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
LESSON 4 PAGE 1
COMPUTER PSEUDO CODES AND FLOW CHARTS
1. Write a pseudo code to calculate age, if older than 50 years
print old.
16
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
SOLUTION 1 PAGE 2
TASK: CALCULATING AGE
Pseudo code
o Start
o Calculate age
o Print age
o End
17
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
SOLUTION 2 PAGE 3
PSEUDO CODE
18
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
SOLUTION 3 PAGE 4
TASK: DETERMINING FAIL AND PASS
Pseudo code
o Start
o Input marks x
o If x < 35 THEN
Output F
ELSE
Output P
o End
19
Mulonga Mathematics Tuitions Online
Add WhatsApp 0955937864 For Lessons
SOLUTION 4 PAGE 5
PSEUDO CODE
END OF LESSON 4
20