GCSE · Computer Science · AQA · Spec 8525
Real division
Share 7 pizzas between 2 friends and nobody settles for three: each gets three and a half. A program doing real division agrees: 7 / 2 is 3.5.
Computer Science · Programming
Real division inside a program
This program averages four test marks. Step through it and keep an eye on the Variables panel.
Stop when line 6 lights up and total holds 29. Before you press Next, commit: will average hold 7, or something else?
1 score1 ← 72 score2 ← 83 score3 ← 64 score4 ← 85 count ← 46 total ← score1 + score2 + score3 + score47 average ← total / count8 OUTPUT average
Variables
Output
Step 1: score1 stores 7.
Press Next to run one line at a time and watch the Variables panel update.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
7 / 2 is 3.5, not 3. Real division keeps the whole answer, fractional part and all.
What you need to know
- Real division divides one number by another and keeps the whole answer, fractional part and all.
- The fractional part is the bit after the decimal point, so 7 / 2 gives 3.5, not 3.
Have a goYour mate insists a program doing 9 / 2 gives 4, "because computers only like whole numbers". What does real division actually give?
4.5
Real division keeps the fractional part. 4 is only the whole part; the half left over doesn't get thrown away.
- In this lesson's pseudo-code, real division is written /, as in average ← total / count.
- Two whole numbers can divide to give an answer that isn't whole: 3 / 4 = 0.75.
- When a division comes out exactly, the answer is a whole number: 10 / 5 = 2.
Have a goPick the one that lands exactly on a whole number: 12 / 5 or 12 / 3?
12 / 3, which is 4
3 goes into 12 exactly, so the fractional part is zero. 12 / 5 = 2.4, which sits between 2 and 3.
- To predict a result, find how many whole times it goes in, then turn the leftover into a fraction.
- A leftover isn't the decimal digits: 5 / 4 leaves 1, and 1 / 4 = 0.25, so the answer is 1.25.
Have a go4 goes into 14 three times with 2 left over. So is 14 / 4 equal to 3.2 or 3.5?
3.5
The leftover 2 is 2 out of 4, which is 0.5. Writing 3.2 copies the leftover in as decimal digits instead of dividing it.
- Order matters: bill / people shares the bill out, but people / bill gives a different, wrong value.
- The variable on the left of ← stores the full result, so a trace shows 7.25, never just 7.
- Not every language treats / on two whole numbers as real division, so check what yours does.
The big picture
Real division divides one number by another and keeps the full answer, including any part after the decimal point: 7 / 2 gives 3.5, not 3. In a program you write it with /, store the result in a variable, and you can predict that value before the program even runs.
Key points
Worked example
Problem
A program stores distance ← 45 and laps ← 6, then runs lapLength ← distance / laps. What value does lapLength store?
⚠ Watch out
Chopping the answer down to a whole number, like writing 29 / 4 as 7 instead of 7.25. It looks tidy. It's wrong. Real division keeps the fractional part. Giving only the whole-number part is a separate operation (integer division), so don't mix the two up.
Memory hook
Nothing gets chopped: 7 / 2 lands at 3.5, between the tick marks, not on the 3.
Check yourself
No calculator: what does x store after x ← 11 / 4? Work out how many whole times 4 goes in, then what the leftover is worth.
Flashcards
(7)What does real division do?
What symbol does this lesson's pseudo-code use for real division?
Can dividing two whole numbers give an answer that isn't whole?
When does real division give a whole-number answer?
total ← 17 and count ← 2. What does total / count give?
What is the difference between bill / people and people / bill?
Does every programming language treat / as real division?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore AQA GCSE Computer Science topics
How this lesson was checked. This AQA GCSE Computer Science (specification 8525)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 28 October 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.