Im just starting to learn C programming and for exercise i found this task. It's a number guessing game where computer guesses the number that i have in mind. First i have to think of a number. Then i have to scan in the range in which the number is. Then computer generates a number in that range and asks me it is correct. Based on computers answer i have to reply with L if its too low, H if it is too high and G if it is correct. If it is correct it prints it out and the number of attempts as well. If any other character is entered it prints out that i have entered the wrong answer.

This is what i've got so far. It doesn't give me any errors but when i enter either L, H or G it prints out that i entered the wrong answer.

Thanks in advance for your help.

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

void main(){

    int randomNo = 0;
    int input = 0;
    int counter = 0;
    int min = 0;
    int max = 0;
    char answer = ' ';
    char low = 'L';
    char high = 'H';
    char good = 'G';

    printf("Enter min and max: ");
    scanf_s("%d %d", &min, &max);       

    do{     
        randomNo = min + rand() % (max - min) + 1;
        printf("Is it %d?\n", randomNo);
        printf("Enter your answer:");
        scanf_s("%s", &answer);

        if (answer == low){
            printf("Number guessed is low\n");
            min = randomNo;
            counter++;
        }
        else if (answer == high){
            printf("Number guessed is high\n");
            max = randomNo;
            counter++;
        }
        else{
            printf("You entered the wrong answer!\nYour answer should be L - too low H - too high G - goed\n");
        }
    } while (answer != good);

    printf("Your answer is correct!\nYou guessed it in %d times!\n", counter);

}

```