Java Online Compiler
Example: Find Quotient and Remainder in Java language
C
C++
C#
Java
Python
PHP
Main.java
STDIN
Run
// Find Quotient and Remainder in Java language import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int dn, dr, qu, rem; // dn - denotes the dividend // dr - denotes the divisor // qu -denotes the Quotient // rem - denotes the remainder System.out.println("-----Enter the dividend & divisor to compute the quotient and remainder-----"); dn = in.nextInt(); dr = in.nextInt(); // Computes the quotient qu = dn / dr; // Computes the remainder rem = dn % dr; System.out.println("\nThe Quotient is " + qu); System.out.println("The Remainder is " + rem); } }
45 26
Output
Clear
ADVERTISEMENTS