Guess a number program with Java

前端 未结 6 1637
情话喂你
情话喂你 2021-01-28 12:06

I am trying to create a program in Java in which the computer randomly guesses a number between 1-100 and allows the user to guess to the number.

If the number is lower

6条回答
  •  爱一瞬间的悲伤
    2021-01-28 12:46

    You need to move the congratulations part out of the while loop. If you guess the correct number, it will not go into the loop and therefore will not ever display that statement. This would be more obvious if you fixed your indentations. Its bad form to have everything at the same indentation level.

提交回复
热议问题