Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Review
So you think you can count?
Rounding functions and more
Review and practice

Instruction

Okay. There is one more useful operator related to division: the modulo operator (%). It returns the remainder of one number divided by another number, like this:

x % y

For instance, 9 % 7 will return 2, because 9 / 7 is 1 with 2 as the remainder. This operator works with integer and decimal numbers.

Shall we try the modulo operator in an exercise?

Exercise

In our game, you can increase your strength by 1 if you sacrifice 7 HP. For each character, show its name and calculate how many health points will be left if the player decides to sacrifice the maximum number of HP. Name the column HPLeft.

Stuck? Here's a hint!

Use HP % 7.