GRADE 04 UNIT 01
COMPUTATIONAL THINKING AND PROGRAMMING
What is Programming?
Programming is the process of writing instructions (called code) that a
computer can follow to complete a task.
A programmer uses special languages called programming languages
(like Python, Java, or Scratch) to write these instructions.
Example:
If you want a robot to move forward and pick up an object, you must
give clear step-by-step instructions using code.
Why is Programming Important?
We use programming to:
1. Build websites Ex: www.gov.lk/
2. Create mobile apps Ex: WhatsApp
3. Make games Ex: Freefire
4. Control robots and machine
5. Solve everyday problems using computers Ex: Calculator
Programming helps us communicate with computers to make them do
useful work.
What is a Program?
A program is a set of instructions written using a programming
language to perform a specific task.
Example 01:
A calculator program that takes two numbers and shows their total.
Input number 1
Input number 2
Add number 1 and number 2
Display total
Example 02:
A converter that takes length in m and convert to cm.
1m 100cm
Input length in meters
Multiply length in meters by 100
Display length in centimeters
Example 03 :
A calculator that multiplies three numbers and display product.
Input number 1
Input number 2
Input number 3
Multiply number1 by number2 by number 3
Display product
What is Problem Analysis?
Before we start coding, we must first understand the problem we want
the computer to solve.
This is called problem analysis.
Problem Analysis includes:
Understanding what needs
to be done
Identifying input (what
data we give)
Identifying output (what
result we expect)
Deciding the steps needed
to go from input to output
This helps in planning a correct and efficient program.
Activity 01 : Analyze the problem and mention the input, process
and output.
1. Find the total marks of a student in three subjects.
2. Calculate the area of a rectangle.
3. Check whether a given number is even or odd.
4. Convert temperature from Celsius to Fahrenheit.
Input celcius
Farenheit = (celcius * 9/5) + 32
Output Farenheit
5. Calculate how much water a person should drink in a day based on
their body weight.
Algorithm
An algorithm is a step-by-step set of instructions designed to solve
a problem or perform a specific task.
Algorithm include input, process and output.
Algorithms can be represented in plain language, pseudo code, or
flowcharts.
Real-life Example of an Algorithm
Wash your hands
1. Turn on the tap
2. Wet your hands
3. Apply soap
4. Rub hands for 20 seconds
5. Rinse with water
6. Turn off the tap
7. Dry hands
Activity 02 : Write algorithms for each of the following scenarios
1. Brushing your teeth
2. Packing your school bag
3. Crossing the road safely
4. Planting a seed in a pot
5. Turning on the computer and opening MS Paint
6. Typing and saving a document in MS Word
7. Creating a square using Scratch or coding blocks
8. Shutting down the computer properly
9. Logging in to a learning website
10. Using an ATM to withdraw money
Flowchart:
A flowchart is a graphical representation of an algorithm using symbols
and arrows.
FLOW CHART SYMBOLS