- Advertisement -
While dividing one number with other, there two outputs we get, one is Reminder – whatever is leftover and one is the quotient.
- Advertisement -
In the following program, we have two integer numbers num1 and num2 and we are finding the quotient and remainder when num1 is divided by num2, so we can say that num1 is the dividend here and num2 is the divisor.
public class JavaExample {
public static void main(String[] args) {
int num1 = 15, num2 = 2;
int quotient = num1 / num2;
int remainder = num1 % num2;
System.out.println("Quotient is: " + quotient);
System.out.println("Remainder is: " + remainder);
}
}
