write a program in java to find quotient and remainder
Answers
To compute the quotient and remainder we have created two variables with the name quotient and remainder respectively.To find the quotient we divide the num1 by num2 using / operator. Since both the variables num1 & num2 are integers, the result will be integer despite the fact that the result of 15/2 is 7.5 mathematically. So the value assigned to the variable quotient after the operation is 7.
To find the remainder, we use the % operator. The remainder of 15/2 i.e 1 is assigned to the variable remainder after operation.
At the end of the program the values of variables quotient and remainder are printed
Answer:
In the above expression 7 is divided by 2, so the quotient is 3 and the remainder is 1. Approach: Divide the dividend by the divisor using / operator. Both dividend and divisor can be of any type except string, the result will also be computed accordingly. Get the remainder using % operator.
Explanation:
hope it helps
please mark me as brainliast