previous
|
start
|
next
Arithmetic (Integer Division)
In division, if at least one of the numbers is a floating-point number, the result is a floating point number:
7.0 / 4.0 /* 1.75 */ 7 / 4.0 /* 1.75 */ 7.0 / 4 /* 1.75 */
If
both
numbers are integers, then the result is an integer:
7 / 4 /* 1 */
To get the remainder of division between two integers, use the modulus operator
%
:
7 % 4 /* 3 remainder */
previous
|
start
|
next