Calculating arithmetic operations

Report a typo

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.

Sample Input 1:

10
5

Sample Output 1:

15
5
50
2

Sample Input 2:

42
7

Sample Output 2:

49
35
294
6
Write 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();
}
}
___

Create a free account to access the full topic