Step 1 · Read and run
The splitter
This chapter's project works out how to share pizzas between friends. Seven friends order three pizzas, with 8 slices in each, at £11.99 a pizza.
The program has four jobs, and each one uses something from this chapter:
- Slices in total: a multiplication.
- Slices each:
//, because nobody gets a part-slice. - Slices left over:
%. - Cost each: a division, tidied up with
round().
Run it. Then try changing the numbers at the top to see it work out a new answer.
Run the program to carry on.