Practice

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   hear noise   go to next page

Answer:

99/100 = 0

It is tempting to think that the answer must be 1, but it is not. 100 goes into 99 zero times, so that is the result.

Practice

The normal rules of arithmetic are used to determine the sign of the result of division:

+num/+div == +result-num/+div == -result+num/-div == -result-num/-div == +result

It is easiest to first calculate the result as if num and div were positive, then apply the above rules. For example:

17/5 == 3-17/5 == -317/-5 == -3-17/ -5 == 3

Of course, you are eager to practice this right away! Mentally (or with scratch paper) decide on the value of each expression. Then click on the button to see the correct value.

Expression ResultExpression Result
12 3 -12 3
-10 5 10 -6
129 100 -19 -10
17 2 -19 2

QUESTION 9:

What is the value of the expression 3/4 ?