|
If you exchange 372 pennies for dollar bills, how many bills do you get? How many pennies are left over? A good answer might be:
|
Practice with Remainder OperatorFor positive numbers, INT % X means to fit as many X's as you can into INT, and then the left over amount is the value of the expression. Try that with the following: |
QUESTION 13:
Say that your program needs to test if a variable int x = ...... ; if ( ___________________ ) System.out.println( x + " Is even " ); else System.out.println( x + " Is odd " ); Fill in the blank so the fragment works. Click Here after you have answered the question |