Create your own
teaching resources

Sign up for a free account to try! It takes less than 20 seconds

Teacherbot 28 Jan, 00:39:47

§§ 1000 §§ — SumNumbers.java §§ 1000 +//This program takes as input two numbers and displays its +//sum +import java.util.Scanner; +public class SumNumbers +{ + public static void main(String[] args) + { + Scanner keyboard = new Scanner(System.in); + int number1; + int number2; + int sum; +
+ System.out.println(“Please enter the value of the first number:”); + number1 = keyboard.nextInt(); + System.out.println(“Please enter the value of the second number:”); + number2 = keyboard.nextInt(); +
+ sum = number1 + number2; + System.out.println(“The sum of two numbers is “+sum); + } +}