+ 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.
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.
+ 1
thank you!
+ 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);
+ 1
Yes, if you put an operation inbetween the x and z.
x + z. Or whatever you meant to do.
0
I want to make sort of a calculator that allows the user to choose what type of arithmetic in the input screen
0
basically what I need is a way to declare what type using an integer
0
how shuld i imput n and m for this m>n
https://code.sololearn.com/cs36wVBczbsF/?ref=app
0
solved!