Home Show/Hide Menu
Bluej Programs
➜ Test-paper-IT-10
➜ Suggestion Paper, Class-12

bluej Programs

3.Write a program to enter 2 values,print quotient and remainder after dividing the first number ny the second number

import java.util.*;
class division
{
    void main()
    {
        Scanner sc=new Scanner(System.in);
        int m,n,q,r;
        System.out.println("Enter two numbers:");
        m=sc.nextInt();
        n=sc.nextInt();
        q=m/n;
        r=m%n;
        System.out.println("Quotient:"+q);
        System.out.println("Remainder:"+r);
    }
}


Output:
Enter two numbers:
45
23
Quotient:1
Remainder:22
 
ADVERTISEMENT