In this article, we will write a Java program to find Quotient and Remainder.
Java Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | public static void main(String[] args) { Scanner scanner = new Scanner(System.in); // Create a Scanner object System.out.print("Enter a dividend number:"); int dividend = scanner.nextInt(); System.out.print("Enter adivisor number:"); int divisor = scanner.nextInt(); int quotient = dividend / divisor; int remainder = dividend % divisor; System.out.println("Quotient = " + quotient); System.out.println("Remainder = " + remainder); } |
Output: