Write a program that reads two integers from the user using Scanner, calculates their sum, and prints the result. The first input represents the number of apples, and the second input represents the number of oranges. The output should display the total number of fruits.
Reading user's input with Scanner
Summing apples and oranges from user input
Report a typo
Sample Input 1:
5
3Sample Output 1:
8Sample Input 2:
10
7Sample Output 2:
17Write a program in Java 17
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// Use a Scanner to read user input
// Read the number of apples from the user
// Read the number of oranges from the user
// Calculate the total number of fruits and print the result
System.out.println();
}
}
___
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.