Professional Documents
Culture Documents
Grade 11
Algorithms
➢ Start
➢ Get three numbers
➢ Store the numbers as a,b,c
➢ Calculate the total of the three numbers by
adding them together
➢ Store the results as SUM
➢ Calculate the average by dividing the SUM
by 3
➢ Store the results as AVG
➢ Display SUM and AVG
➢ Stop
Pseudocode Algorithm
Start
Write “ Please enter 3 numbers”
Read a,b,c
Set sum a+b+c
Set average sum/3
Write “The sum is: “, sum
Write “The average is :” average
Stop
Example of pseudocode using
selection
Start
Write “Please enter 2 number”
Read a, b
If a>b then
Write “The first number is higher”
Else
Write “The second number is higher”
Endif
Stop
Pseudocode using Bounded
iteration
Start
Set i 1
For i = 1 to 10 do
Set multiple[i] i*2
Write “1 x 2 = ”, multiple[i]
i=i+1
Endfor
Stop
Flowchart
Start/Stop Oval
Input/Output Parallelogram
Assignment/Calculation Rectangle
Decision Rhombus
Continuation Circle
Direction Arrow
Examples of a flowchart
Truth Tables
Name A B C D F Pass/Fail
John 1 0 0 0 0 1
Patty 0 0 1 0 0 1
Mia 0 0 0 0 1 0
Zack 0 0 0 1 0 0
Kate 0 0 0 0 1 0
Tom 0 0 0 1 0 0
Cindy 0 1 0 0 0 1
Trace Table
A trace table is a technique used to test algorithms in order to
make sure that no logical errors occur while the calculations
are being processed. The table usually takes the form of a
multi-column, multi-row table; With each column showing a
variable, and each row showing each number input into the
algorithm and the subsequent values of the variables.
https://www.101computing.net/wp/wp-content/uploads/trace-table-s.gif
The End
L/O/G/O