|
A good answer might be:
It looks as though this is a mistake, but no: each 1/2 calls for integer division, resulting in an integer 0. The two zeros are added to get the final answer, zero.1/2 + 1/2 = 0 |
Copy-and-Paste ProgramIf you really want to add one half to one half you should write 1.0/2.0 + 1.0/2.0 because now the decimal points make each number a double. Here is a Java application that illustrates these points:
Remember that you can run this program by copying it to Notepad, saving to a file integerDivision.java, compiling and running it. See a previous chapter for details on doing this. It would be nice if you made a few changes to the program in Notepad then ran the program again the see the effect.
Notice the parentheses around |
QUESTION 5:What is the value of the expression 99/100 ? Click Here after you have answered the question |