Welcome to My Presentation!!
COMPUTING (PRIMARY 6)
Simple Plan
In this lesson
How to simplify a problem
How to plan a solution to a problem
How to make a program to match the plan
Algorithm
• An algorithm is a set of steps needed to solve a problem
• It can guide through the tasks whether it is big or small.
Think about making breakfast!!!
1. Heat the Pan
2. Add Butter or Oil
3. Crack the Egg
4. Cook the Egg
5. Add Salt
6. Serve
you will follow a series of steps in a recipe to fry an egg.
These steps which are carried out to achieve a desired
outcome are algorithms.
This concept can be applied to programming.
However, it is important to know that algorithms are not written in code.
Instead, algorithms are planned and written in a simple language humans can
understand during the planning stage of program development.
Understanding the distinction between algorithms and programming is
fundamental.
It is important to know the steps how the transition from algorithms to working
programs take place.
Program requirement
The requirement tells you what the program must do
For example :
Create a program that adds two numbers together and shows the result.
1. When you have to solve a problem in real life, what is the
first step you do?
2. Is it better to solve a problem efficiently with a well-
prepared plan?
3. What are the advantages of planning the step-by-step
solution to solve a certain problem?
Program Plan/Algorithm
Before a programmer starts work, they make a program plan.
A program plan sets out the steps to solve a problem (Input,
Processor, Output)
Another word for a plan to solve a problem is an algorithm.
Input Processing Output
Program Plan for a quiz program
Input
Processing Output
(Ask a quiz question and get the
(Check if the answer is right) (Tell the user if the answer is right)
answer)
Input Ask “What is 19+4?”
Input “Answer”
Processing ‘solution’ = 23
Output Say “solution”
Create a program that adds two numbers together and shows the result.
(Creating the program)
(Creating an algorithm or plan)
● Set total to 0.
● Set first_number to 0.
● Set second_number to 0.
● Input first_number.
● Input second_number.
● Add first_number and second_number
and set the result to the total.
● Output the total.
This is where the algorithm is turned into a code
Algorithm for adding two numbers together and shows the result using the programming language.
Challenges:
1. Which block asks the input from the user?
2. Which block gives the output?
Program requirement Count from 1 to 10.
(Creating the program)
(Creating an algorithm or plan)
With Conditional Loop
Challenges
1. You can make this program with a counter loop or
conditional loop. However, you couldn’t use a forever
loop. Why not?
Calculate a total by adding ten numbers
input by the user.
Start Simple
Ask for a number from the user and
find out if the number is even or odd.
Calculate a total by adding one
number input by the user.
1. Set total to 0
2. Input a number
3. Add number to total to give the new total
4. Output the total
How to extend the program
1. Set total to 0
2. Loop these command 10 times
Input a number
Add number to total to give the new total
3. Output the total