Read this chapter, which discusses arithmetic operations in greater detail along with solving expressions with mixed data types.
14. Remainder Operator
Answer:
3
Remainder Operator
You may recall how in grade school you did division like this:
13 / 5 == 2
with a remainder of 3
.
This is because 13 == 2*5 + 3
.
The symbol for finding the remainder is %
(percent sign). If you look in the operators, table of table
of operators you will see that it has the same precedence as /
and *
. Here is a program:
|
Question 14:
Will the following always print out the original integer, regardless of what it was?
System.out.println("The original : " + (quotient*3 + remainder) );