What is the remainder after dividing 13 by 5?

A good answer might be:

3

Remainder Operator

You may recall in fourth grade doing division like this:

or: 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 table of operators you will see that it has the same precidence as * and /.


class remainderExample
{
  public static void main ( String[] args )
  {
    int quotient, remainder;

    quotient  =  17 / 3;
    remainder =  17 % 3;
    System.out.println("The quotient : " + quotient );
    System.out.println("The remainder: " + remainder );
    System.out.println("The original : " + (quotient*3 + remainder) );
  }
}

It would be useful to copy-and-paste this program to run it.

QUESTION 11:

Why were the innermost set of parentheses used in the statement:

    System.out.println("The original : " + (quotient*3 + remainder) );

Click Here after you have answered the question