Last Updated: 09 July, 2022

Example 1: Find the quotient and remainder in Java

Output

The Divisor value is: 6 The Divident value is: 40 Quotient is: 6 Remainder is: 4

Example 2: Find the quotient and remainder using Java Scanner Class

Output

Enter the divisor value: 6 Enter the divident value: 31 The Quotient is = 5 The Remainder is = 1

Example 3: Throws ArithmeticException if divisor is 0 (zero)

Output

Exception in thread "main" java.lang.ArithmeticException: / by zero at com.javabytechie.programs.find.quotient.remainder.Example3.main(Example3.java:7)

That's all guys, hope this Java Program is helpful for you.

Happy Learning... 😀

If you have any query or suggestion regarding this artical please share with us

`feedback@javabytechie.com`