+ 1

It's ok when I ain't entering p and s but when I enter p and s it is also showing invalid character

https://code.sololearn.com/cuiU0B7l6AuG/?ref=app

16th Sep 2020, 2:59 AM
Shubhankar Anand
Shubhankar Anand - avatar
2 odpowiedzi
+ 5
I see. Scanner nextInt() does not read the newline input when you press enter (or in the case of Code Playground, when you submit multiple input on different lines). What you can do, is to put a dummy nextLine() call after you are done calling nextInt(). a=csk.nextInt(); b=csk.nextInt(); c=csk.nextInt(); csk.nextLine(); // this will consume the newline
16th Sep 2020, 3:05 AM
Hatsy Rei
Hatsy Rei - avatar
+ 2
Thankyou very much
16th Sep 2020, 3:14 AM
Shubhankar Anand
Shubhankar Anand - avatar