Hint: There are 5280 feet in a mile.
2. Write a Java program that displays the results of the expressions 15/4, 4/15, 15%4, 4%15. Calculate the values of these expressions manually to verify that the displayed values are correct.
15/4 = 3.75與用小算盤計算的結果相同
4/15 = 0.26666666666666666 因為使用double宣告,所以精準度到16位!
15%4 = 3.0 ==>15/4 得3餘3 正確!
4%15 = 4.0 ==>4/15 餘4 正確!
沒有留言:
張貼留言