go to previous page   go to home page   go to next page hear noise

If you exchange 372 pennies for dollar bills, how many bills do you get? How many pennies are left over?

Answer:


Practice with Remainder Operator

For positive integers, INT % X means to fit as many X as you can into INT, and then the left over amount is the value of the expression. Try that with the following:

Expression ResultExpression Result
7 3 7 5
10 5 10 6
129 100 1999 100
17 2 18 2

QUESTION 16:

If X is odd, what is X % 2?


go to previous page   go to home page   go to next page