Java Program to Find Quotient and Remainder

In this post, we will write a Java program to find Quotient and Remainder

In this example we have two integer numbers a and b and we are finding the quotient and remainder when a is divided by b, so we can say that a is the dividend here and b is the divisor.

Let's check Example

public class JavaExample {
    public static void main(String[] args) {
        int a= 26, b= 3;
        
        int quotient = a/ b;
        
        int remainder = a% b;
        
        System.out.println("Quotient is: " + quotient);
        
        System.out.println("Remainder is: " + remainder);
        
    }
}

 

Output

Quotient is: 8

Remainder is: 2

 


Subscribe For Daily Updates

JAVA File IO examples

JAVA Date & Time Progamming Examples

JAVA Collections

Flutter Questions
Android Questions