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
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.