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

Where do these answers land?

No calculator. Drag each division to where you think its answer lands. Right on a whole number, or somewhere 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, commit: 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

Press Next to run one line at a time and watch the Variables panel update.

Step 1 of 8: score1 stores 7..

Computer Science · Programming

Which line of this trace is wrong?

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 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

1Predicting 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 yours 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, 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?
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 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.