import java.util.Random; import java.util.Scanner; public class Main { public static void main(String[] args) { Random random = new Random(); Scanner scan = new Scanner(System.in); int randomValue = random.nextInt(101); int guess = -1; while(randomValue != guess) { System.out.print("Guess the number: "); guess = scan.nextInt(); if(guess < randomValue) { System.out.println("You're too low"); } else if(guess > randomValue) { System.out.println("You're too high"); } else { System.out.println("You guessed the right number"); } } scan.close(); } }