In this tutorial learn how you can write a program to find the quotient and remainder of two Integers in java. We use the Scanner class for taking inputs from the user and declaring variables dividend, divider, quotient, and the remainder to store the value.
Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible.
Here is the code to find the quotient and remainder of two Integers in Java programming.
//Write a Java Program to Find the Quotient and Remainder of Two Integers import java.util.Scanner; public class Quotient { public static void main(String[] args) { int dividend, divider, quotient, remainder; Scanner data = new Scanner(System.in); System.out.println("Enter your dividend(The number you want to divide): "); dividend = data.nextInt(); System.out.println("Enter your divider(The number which divide the dividend): "); divider = data.nextInt(); quotient = dividend / divider; remainder = dividend % divider; System.out.println("When " + dividend + " is divided by " + divider + " , we will get quotient " + quotient + " and remainder " + remainder + "."); data.close(); } }
This is how you can write a program to find the quotient and remainder of two Integers in java programming. Comment below if you like our tutorial.