+ 1
How to take two inputs in the same line
For e.g. "Enter 2 integers"n1,n2. is this really possible?
2 Answers
+ 4
What language? It is possible, but varies depending on the language used and in some cases the type of input needed. For instance, in Java you can get 2 integers from the same string input using a Scanner and its nextInt() method:
Scanner sc = new Scanner(System.in);
System.out.print("Enter two space separated integers: "); // User inputs "100 54"
int firstInt = sc.nextInt(); // firstInt is 100
int secondInt = sc.nextInt(); // secondInt is 54
+ 3
thanks, it's for java