menu
QAmmunity.org
Login
Register
My account
Edit my Profile
Private messages
My favorites
Register
Ask a Question
Questions
Unanswered
Tags
Categories
Ask a Question
How can I get multiple user inputs in Java ? I want to be able to use it for subtraction, addition,division and multiplication.For example it should run like How many numbers do you want to subtract? 4
asked
Jan 4, 2023
96.5k
views
14
votes
How can I get multiple user inputs in Java ? I want to be able to use it for subtraction, addition,division and multiplication.For example it should run like
How many numbers do you want to subtract?
4
Enter 4 numbers:
1
2
3
4
result:-8
Computers and Technology
college
Scindix
asked
by
Scindix
7.8k
points
answer
comment
share this
share
0 Comments
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
1
Answer
10
votes
You can do something like this :
Scanner sc = new Scanner(System.in);
int[] nums = new int[4];
for(int i = 0; i < nums.length; i++) {
System.out.println("Enter next number: ");
nums[i] = sc.nextInt();
Ewing
answered
Jan 11, 2023
by
Ewing
8.3k
points
ask related question
comment
share this
0 Comments
Please
log in
or
register
to add a comment.
Ask a Question
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.
9.3m
questions
12.0m
answers
Other Questions
“What does it mean when we “rework” copyrighted material?”
The book shows how to add and subtract binary and decimal numbers. However, other numbering systems are also very popular when dealing with computers. The octal (base 8) numbering system is one of these.
Explain why binary codes are used to represent characters, numbers and symbols :)
What is an example of a dedicated computer system?
This is science they just dont have the subject buy anyways describe interactions you have with the environment that you depend on to meet your basic needs hope u can help
Twitter
WhatsApp
Facebook
Reddit
LinkedIn
Email
Link Copied!
Copy
Search QAmmunity.org