#include <stdlib.h>
#include <stdio.h>
#include <time.h>
main()
{
int magic,guess,counter;
srand (time (NULL));
magic = rand() %100 +1;
counter =0;
do
{
printf("Please guess amagic number:");
scanf("%d", &guess);
counter ++;
if (guess > magic)
printf("Wrong!Too high!\n");
else if (guess < magic)
printf("Wrong!Too low!\n");
} while (guess != magic);
printf("Right!\n");
printf("counter = %d \n", counter);
}