+ 1
How to make the "Enter the number" continue again and again?
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner in= new Scanner(System.in); System.out.print("Enter a number: "); int num = in.nextInt(); while(num >= 0){ System.out.print(num); num--; } } }
15 Answers
+ 4
If you are asking about Sololearn Playground then it's not possible here. You have to run each time to take input.
+ 4
put the entire thing in a loop. infinite loop is impossible though in SL playground.
+ 1
you know how to write loop right ? i see it in the code you're presenting.
its same as that but its cover most of the code
+ 1
That's what I would want from the platform. The data input and output could be made interactive.
0
Taste how to make the entire thing loop though?
0
strykds can you just write how you want the output to be.
0
Avinesh Enter a number: 5
5 4 3 2 1 0
Enter a number: 4
4 3 2 1 0
Enter a number: 2
2 1 0
And so on...
0
See if this is what you are looking for.
But you asked the same question in your last post as well.
https://code.sololearn.com/c0pIzA8RJe36/?ref=app
0
Avinesh after it showed up "enter a number" though, it already said process finished
0
The way you showed your output, this is how you do it.
Do you want to enter the numbers again and again? If so, till when?
0
while(true ){
//code
}
0
look up how to make a loop. should hopefully help
0
Loop
0
Iteration in JAVA
0
It is possible, check out this code
https://code.sololearn.com/chKSj9L2ekLA/?ref=app