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
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
dividend
and divisor
. Here, we are calculating the quotient and remainder by dividing 222 by 4.println()
function.
Comments