Java Program To Find Quotient And Remainder
Chapter:
Math Class
Last Updated:
25-08-2017 08:36:04 UTC
Program:
/* ............... START ............... */
public class JavaQuotientAndRemainder {
public static void main(String[] args) {
int dividend = 29, divisor = 4;
int quotient = dividend / divisor;
int remainder = dividend % divisor;
System.out.println("Quotient = " + quotient);
System.out.println("Remainder = " + remainder);
}
}
/* ............... END ............... */
Output
Quotient = 7
Remainder = 1
Notes:
-
In arithmetic, the remainder is the integer "left over" after dividing one integer by another to produce an integer quotient (integer division).
- Quotient is the quantity produced by the division of two numbers.
- In the above program we divide dividend by divisor using / operator. Since, both dividend and divisor are integers, the result will also be computed as an integer.
Tags
Find Quotient And Remainder, Java, Java Math