;

# Java Program to Compute Quotient and Remainder

###### Tutorialsrack 19/04/2021 Java

In this java program, you will learn how to compute quotients and remainder from the given dividend and divisor in Java.

### Java Program to Compute Quotient and Remainder

##### Java Program to Compute Quotient and Remainder
``````//Java Program to Compute Quotient and Remainder

public class JavaPrograms {

public static void main(String[] args) {

int dividend = 222, divisor = 4;

int quotient = dividend / divisor;
int remainder = dividend % divisor;

System.out.println("Quotient = " + quotient);
System.out.println("Remainder = " + remainder);

}
}``````

Quotient = 55

Remainder = 2

### Understand the program

• In the above java program, we have created two variables: `dividend` and `divisor`. Here, we are calculating the quotient and remainder by dividing 222 by 4.
• To find the quotient, we have used the / operator. We have divided dividend (222) by divisor (4). Since both dividend and divisor are integers, the output will also be integers.
• 222 / 4 // results 55.5
• // convert 55.5 to integer
• // output will be 55
• Likewise, to find the remainder we use the mod( % ) operator. Here, the dividend is divided by the divisor, and the remainder is returned by the mod( %) operator.
• 222 % 4 // results 2
• Finally, quotient and remainder are printed on the screen using `println()` function.