import java.util.Scanner; public class GuessNumber { public static void main(String[] args) { Scanner input = new Scanner(System.in); int x = (int) (101*Math.random()); int guess = -1; // Need to start with an incorrect guess... while ( guess != x ) { System.out.print("Enter a guess between 0 and 100: "); guess = input.nextInt(); if ( guess < x ) System.out.println("too low"); else if ( guess > x ) System.out.println("too high"); else System.out.println("correct"); } } }