Answer the question
In order to leave comments, you need to log in
How to enter n numbers and output them?
You need to enter n numbers from the console and output them.
Need a code.
Answer the question
In order to leave comments, you need to log in
Why is it that shkolota, who perceives it as a resource that is obliged to solve their homework for them, is sure to run into any specialized site?
The question is, of course, rhetorical...
I'm just adding to the advice you've already been given.
Here is the scanner documentation:
https://vertex-academy.com/tutorials/ru/rabota-so-...
Algorithm for implementing your task:
- create a while loop with some condition.
- use the Scanner class to get the numbers from the stream. Pay attention to nextLine() nextInt() nextDouble()
- add each received number to the collection. For example List<Long> List<Double> List<Integer>
- if the user entered for example exit, then set the value of the condition in the while loop to false and exit input mode
- iterate over the collection of numbers and do System.out.println()
I think that's enough for you to write the code. I will not write code, because you have to learn how to do it yourself
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question