GCSE · Computer Science · AQA · Spec 8525

Real division

Share 7 pizzas between 2 people and each gets three and a half, not three. A program doing real division agrees: 7 / 2 is 3.5.

Computer Science · Programming

Where do these answers land?

No calculator yet. Drag each division to where you think its answer lands. On a whole number, or between two?

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, predict: will average hold 7, or something else?

1 score1 ← 7
2 score2 ← 8
3 score3 ← 6
4 score4 ← 8
5 count ← 4
6 total ← score1 + score2 + score3 + score4
7 average ← total / count
8 OUTPUT average

Variables

score1=7

Output

 

Step 1: score1 stores 7.

1 / 8

Use Next to go one line at a time and watch the Variables panel update.

Step 1 of 8: score1 stores 7..

Computer Science · Programming

Spot the slip in this trace

This program turns a time in seconds into minutes. A student has written what each line stores. Which line did they get wrong?

A student's trace — which line goes wrong?

Computer Science · Programming

Your turn: write the division

Complete a program that shares a bill of 18 equally between 4 people and outputs each person's share.

  1. bill ← 18
  2. people ← 4
  3. missing step
Which line is step 3?

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 gives the full answer, keeping any fractional part (the part after the decimal point).
  • In the pseudo-code in this lesson, real division is written with /, for example average ← total / count.
  • Dividing two whole numbers can give an answer that isn't whole: 7 / 2 = 3.5 and 3 / 4 = 0.75.
  • When a division comes out exactly, the answer is a whole number: 10 / 5 = 2.
  • Order matters: bill / people shares the bill between the people, but people / bill gives a completely different value.

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 can predict that value before the program runs.

Key points

1To predict a real division result, find how many whole times it goes in, then turn what's left over into a fraction: 9 / 4 is 2 with 1 left over, and 1 / 4 = 0.25, so 9 / 4 = 2.25.
2When you trace a program, a variable that stores a real division result holds the full value. Write 7.25, not 7.
3Divide by the variable (count, people) rather than a fixed number, so the program still works when the data changes.
4Not every programming language treats / the same way when both numbers are whole, so check which kind of division your language is doing. In this lesson, / always means real division.

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, for example writing 29 / 4 as 7 instead of 7.25. 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?
Divides one number by another and keeps the fractional part of the answer. For example, 7 / 2 = 3.5.
What symbol does this lesson's pseudo-code use for real division?
/ (a forward slash), as in average ← total / count.
Can dividing two whole numbers give an answer that isn't whole?
Yes. 1 / 4 = 0.25 and 11 / 2 = 5.5.
When does real division give a whole-number answer?
When the division comes out exactly, for example 12 / 4 = 3. The fractional part is then zero.
total ← 17 and count ← 2. What does total / count give?
8.5. The .5 is kept.
What is the difference between bill / people and people / bill?
bill / people shares the bill between the people. people / bill divides the other way round and gives a different, wrong value for a share.
Does every programming language treat / as real division?
No. In some languages, dividing two whole numbers with / behaves differently, so check which kind of division your language is doing.

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 posted

More AQA GCSE Computer Science topics

See the full AQA Computer Science curriculum →

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 30 September 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.