0

how to add two numbers in java by taking input by user?

10th Sep 2016, 8:26 AM
Sourabh jain
Sourabh jain - avatar
3 Answers
+ 2
by importing java.util.Scanner to your program. import java.util.Scanner; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int sum = a+b; System.out.println(sum); }
10th Sep 2016, 8:34 AM
supply497
supply497 - avatar
0
🍁👏👏👏
10th Sep 2016, 10:32 AM
Sourabh jain
Sourabh jain - avatar
0
use scanner or BufferedReader
13th Sep 2016, 5:38 PM
Teja Naraharisetti
Teja Naraharisetti - avatar