ava program to add two numbers taking input from user

Solutions on MaxInterview for ava program to add two numbers taking input from user by the best coders in the world

showing results for - "ava program to add two numbers taking input from user"
Leni
04 Aug 2018
1import java.util.Scanner;public class Main{public static void main(String[] args){int a, b, sum;Scanner sc = new Scanner(System.in);System.out.println("Enter First Number: ");a = sc.nextInt();System.out.println("Enter Second Number: ");b = sc.nextInt();sc.close();sum = a + b;System.out.println("Sum of these numbers: "+sum);}}