Computer Science, asked by mahibisht01, 11 months ago

write a program in Java to find quotient and remainder by dividing two integers . user will input the number at the time of execution​

Answers

Answered by rakeshchennupati143
17

Program:

import java.io.*;

import java.util.*;

public class Main{

   public static void main(String args[]){

       Scanner sc = new Scanner(System.in);

       System.out.println("Enter 2 number");

       int num1 = sc.nextInt();

       int num2 = sc.nextInt();

       System.out.println("Quotient of "+num1+" divided by "+num2+" is :"+(num1/num2)+"\nReminder of "+num1+" divided by "+num2+" is : "+(num1%num2));

   }

}

Output:

Enter 2 number                                                      

4                                                

2                                                

Quotient of 4 divided by 2 is :2                                            

Reminder of 4 divided by 2 is : 0

Explanation:

  1. i took two number at the point of executing time
  2. and i directly printed quotient and reminder of those two number
  3. quotient formula num1 ÷ num2 = quotient
  4. reminder formula num1 % num2 = reminder

---Hope this Helps you   :)

Similar questions