public class DivideTwoNumbers
{
public void main() {
int num1 = 5, num2 = 15, prod;
div= num2 / num1;
System.out.println("Quotient of the two numbers are:"+div);
}
}
Output:
Quotient of the two numbers are: 3
Answers
Answered by
7
Answer:
import java.util.Scanner;
public class Exercise6 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Input first number: ");
int num1 = in.nextInt();
System.out.print("Input second number: ");
int num2 = in.nextInt();
System.out.println(num1 + " + " + num2 + " = " +
(num1 + num2));
System.out.println(num1 + " - " + num2 + " = " +
(num1 - num2));
System.out.println(num1 + " x " + num2 + " = " +
(num1 * num2));
System.out.println(num1 + " / " + num2 + " = " +
(num1 / num2));
System.out.println(num1 + " mod " + num2 + " = " +
(num1 % num2));
}
}
Explanation:
Similar questions