#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define NO 0
#infine YES 1
main()
{
int guess_value = -1;
int number;
int nbr_of_guesses;
int done = NO;
printf ("\n\nGeting a Random number:\n");
srand ((unsigned) time(NULL));
number=rand();
nbr_of_guesses = 0;
while(done==NO)
{
printf("\nPick number between 0 and %d>",RAND_MAX);
scanf("%d",guess_value);
nbr_of_guesses++;
if(number==guess_value)
{
done=YES;
}
else
if(number<guess_value)
{
printf("\nYou guessed high!");
}
else
{
printf("\nYou guesses low!");
}
}
printf("\n\nCongratulations!you guessed right in %d guesses!,
nbr_of_guessess");
printf("\n\nThe number was %d\n\n",number);
return 0;
}