I am trying to make a quiz program that reads questions from one file and answers from another file, put them in strings and compare them with strcmp(), but for some reason its not working when I put in a correct answer it says its not correct. Any help would be appreciated.
My Code
int main()
{
    FILE *fpq = fopen("questions.txt", "r");
    FILE *fpa = fopen("answers.txt", "r");
    char question[256];
    char answer[256];
    char user_input[256];
    fgets(question, 256, fpq);
    fgets(answer, 256, fpa);
    puts(question);
    fgets(user_input, 256, stdin);
    if(strcmp(user_input, answer) == 0)
    {
      printf("Good job!\n");
    }
    else
    {
      printf("Nope its:\n");
      puts(answer);
    }
    fclose(fpq);
    fclose(fpa);
    return 0;
}
 
     
     
     
    