#include <stdio.h>
int main(void)
{
int bd_day = 27;
int guess, max = 31, min = 1, i = 0;
printf("You have 3 times to try\n");
while (i++ < 3)
{
printf("Guess the day of my Birthday (1-31): ");
scanf("%d",&guess);
if (guess == bd_day)
{
printf("You Win!\n");
}
else if (guess < min)
{
printf("Day is between 1 to 31\n");
}
else if (guess > max)
{
printf("Day is between 1 to 31\n");
}
else if (guess > bd_day)
{
printf("Too High\n");
}
else if (guess < bd_day)
{
printf("Too Low\n");
}
else
{
printf("Try again!\n");
}
}
return 0;
}
/*
run:
You have 3 times to try
Guess the day of my Birthday (1-31): 3
Too Low
Guess the day of my Birthday (1-31): 30
Too High
Guess the day of my Birthday (1-31): 27
You Win!
*/