Write a Java program that reads two integers from the user and prints their sum, difference, product, and quotient. The program should print each result on a separate line.
Printing data
Calculating arithmetic operations
Report a typo
Sample Input 1:
10
5Sample Output 1:
15
5
50
2Sample Input 2:
42
7Sample Output 2:
49
35
294
6Write a program in Java 17
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// Read two integers from the user
int num1 = scanner.nextInt();
int num2 = scanner.nextInt();
// TODO: Calculate the sum of num1 and num2
// TODO: Calculate the difference of num1 and num2
// TODO: Calculate the product of num1 and num2
// TODO: Calculate the quotient of num1 divided by num2
scanner.close();
}
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.