Answer:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void) {
srand(time(NULL));
int num = rand() % 15 + 1;
int guess_status = 0;
int current_guess;
int count = 0;
printf("Welccome to the guess a number game! \\");
printf("I'm thinking of a number between 1 and 15 (1 and 15 are included).\\");
printf("Guess the number: ");
do {
scanf("%d", ¤t_guess);
count++;
if (current_guess == num) {
printf("Your guess is correct, the number is %d\\", current_guess);
guess_status = 1;
}
else if(count == 3){
printf("Your guess is wrong, the number is %d\\", num);
break;
}
else if (current_guess < num) {
printf("Your guess is too low, try something higer: ");
}
else if (current_guess > num) {
printf("Your guess is too high, try something higer: ");
}
} while (guess_status == 0);
return 0;
}