#include <stdio.h>
#include <stdlib.h>

int main()
{
	int guess = -1, count = 0, answer = (rand() % 100) + 1;

	printf("Guess on a number between 1 and 100\n");

	for(;;)
	{
		printf("Your guess: ");
		scanf("%d", &guess);
		count++;

		if(guess > answer)
			printf("The number is smaller\n");
		else if(guess < answer)
			printf("The number is bigger\n");
		else
		{
			printf("It took you %d guesses to find the number.\n" , count);
			break;
		}
	}

	exit(EXIT_SUCCESS);
}

