+ 1
Why this doesn't work?
this has to output as many lines of code as the number you input https://code.sololearn.com/cDFBU7bjolvh/?ref=app https://code.sololearn.com/cDFBU7bjolvh/?ref=app
6 ответов
+ 2
You need to store the integer of the scanner in a variable before your while : else each loop of your while will try to read the next value of your scanner "value" which doesn't exist if the user just inputs one integer (which is your intended use I guess). Try to replace l.9 of your code with that piece :
int num=value.nextInt();
while(x < num){
Should work. Do you understand the problem ?
Edit : be careful also, your main method e.g. the line 5
public static void Main(String[] args) {
should have "main" not capitalized.
+ 1
Ignore my first awnser, it shouldn't be capitalized
I haven't looked at java since a long time
+ 1
dhm thanks, that worked
0
main should be capitalized
Edit: ignore
0
Niek Aukes still doesn't work
0
Niek Aukes any ideas how to fix?