0
how to add two numbers in java by taking input by user?
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);
}
0
đđđđ
0
use scanner or BufferedReader