Multiple Inputs? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Multiple Inputs?

I have a question, how do I get multiple inputs example; Multiple Inputd for + * % /. if you know the answer, just post it here.

28th Jun 2017, 5:03 PM
RF Dreamers!
RF Dreamers! - avatar
8 Answers
+ 3
Use scanner and use some next() method. Same as taking 1 input. Whether it be next(), nextLine(), nextInt(), etc.. CodePlayground is a bit different because it asks for all input right when the program is run. To make multiple inputs for this, separate each input on a new line. Example input: / 3 2 Expected output: 3 / 2. In other compilers you won't need to do this, as you can just type it in when asked.
28th Jun 2017, 5:32 PM
Rrestoring faith
Rrestoring faith - avatar
+ 1
thank you!
28th Jun 2017, 5:32 PM
RF Dreamers!
RF Dreamers! - avatar
+ 1
would this line of code work? Scanner a = new Scanner(System.in); int x = a.nextInt(); int y = a.nextInt(); int z = a.nextInt(); int sum = y %x z; System.out.println(sum);
28th Jun 2017, 9:06 PM
RF Dreamers!
RF Dreamers! - avatar
+ 1
Yes, if you put an operation inbetween the x and z. x + z. Or whatever you meant to do.
28th Jun 2017, 9:23 PM
Rrestoring faith
Rrestoring faith - avatar
0
I want to make sort of a calculator that allows the user to choose what type of arithmetic in the input screen
1st Jul 2017, 3:49 AM
RF Dreamers!
RF Dreamers! - avatar
0
basically what I need is a way to declare what type using an integer
1st Jul 2017, 3:49 AM
RF Dreamers!
RF Dreamers! - avatar
0
how shuld i imput n and m for this m>n https://code.sololearn.com/cs36wVBczbsF/?ref=app
14th May 2018, 6:25 AM
Nemeti Alin
Nemeti Alin - avatar
0
solved!
14th May 2018, 9:41 AM
Nemeti Alin
Nemeti Alin - avatar