Please find error in my short code... I am a newbie 😂 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please find error in my short code... I am a newbie 😂

Why is this code not working? Please Help https://code.sololearn.com/c6Xu7KEeX2f0/?ref=app Edit : Problem Solved 👍

21st Feb 2020, 4:02 AM
Ravi Prakash Dixit
Ravi Prakash Dixit - avatar
6 Answers
+ 6
It is nextLine() not nextline(). One error,fix it and it works.
21st Feb 2020, 4:06 AM
Ketan [#Be Happy 😄]
Ketan [#Be Happy 😄] - avatar
+ 5
Ravi Prakash Dixit the code playground works differently. You have to input all the data before running your code because the sololearn server executes everything at once. So make the change mentioned by Ketan and give your input before running your code.
21st Feb 2020, 4:47 AM
Avinesh
Avinesh - avatar
0
Ketan, thanks for engaging in the problem!! I guess, its not working correctly.. I want the program to ask first and then u enter ur food and finally it should print the last line!! But, its not doing in this manner..??!
21st Feb 2020, 4:12 AM
Ravi Prakash Dixit
Ravi Prakash Dixit - avatar
0
Avinesh , that doesn't really serve the purpose of whole program however small!! When the user doesn't know the question, how can he answer in advance ??
21st Feb 2020, 6:10 AM
Ravi Prakash Dixit
Ravi Prakash Dixit - avatar
0
Avinesh okay 👌
21st Feb 2020, 6:16 AM
Ravi Prakash Dixit
Ravi Prakash Dixit - avatar