import java.util.Scanner;
import java.util.Random;
class Assignment5c
{
	public static void main (String[] args)
	{
         int guess;
         Random generator = new Random();
         int correctAnswer=generator.nextInt(100)+1;
         int counter=0;
         Scanner input = new Scanner (System.in);
         System.out.println("This program will guess a number from 1 to 100 ");
         do
			{
				System.out.println("Please type in a guess ");
				counter=counter+1;
		        guess=input.nextInt();
		        if (guess > correctAnswer)
		          	System.out.printf("The number %d is greater than the correct number\n",guess);
				else if (guess < correctAnswer)
		          	System.out.printf("The number %d is less than the correct number\n",guess);
				else if (guess == correctAnswer)
					System.out.printf("The number %d is the correct number\n",guess);
		
		       	 	
			}while (guess != correctAnswer);
         System.out.printf("It took you %d guesses to find the correct number\n",counter);
	  
	}
} 