+ 1
Java
Please write a program that asks for two numbers and then displays the amount on the screen (Java)
1 Réponse
+ 1
import java.util.Scanner;
public class Main {
public static void main(String[] args)
{
Scanner input = new Scanner (System.in);
System.out.print("Input the first number: ");
int num1 = input.nextInt();
System.out.print("Input the second number: ");
int num2 = input.nextInt();
int sum = num1 + num2;
System.out.println();
System.out.println("Sum: "+sum);
}
}