java

Java Program to find Quotient & Remainder

In this post, we are going to write a simple Java Program to find the Quotient & Remainder. Before writing the program, let’s see what is a Remainder and a Quotient in mathematics?.

Here is an example:
45           ÷         7           =           6           and           3
Dividend Divisor Quotient Remainder

In the above example, 45 is the Dividend, 7 is the Divisor, 6 is the Quotient and 3 is the Remainder.

So the remainder is the “left over” value after dividing one integer by another. Quotient is the quantity produced by the division of 2 integers.

So in Java Program we can achieve this by using the / and % operators, see the below expressions

quo = dividend / divisor -> will give the quotient
rem = dividend % divisor -> will give the remainder

Let’s write the Java Program now:

Output of the above program:

Related Posts

Leave a Reply