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
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:
- i took two number at the point of executing time
- and i directly printed quotient and reminder of those two number
- quotient formula num1 ÷ num2 = quotient
- reminder formula num1 % num2 = reminder
---Hope this Helps you :)
Similar questions
World Languages,
6 months ago
Math,
6 months ago
Math,
6 months ago
Science,
11 months ago
Social Sciences,
11 months ago
Chemistry,
1 year ago
Computer Science,
1 year ago