Why does my code skips a statement
I am new to C and I am attempting a program where it continuously ask for the user's name. However, although the program works it skips the first statement. Desired code: Output: Enter name: User Input: <name> Output: Your name is <name>. Do you want to add another name? User input: yes (starts all over) Current code: Output: Enter name: User Input: <name> Output: Your name is <name>. Do you want to add another name? User input: yes Output: Your name is. Do you want to add another name? (Ps. "Enter name" wont display) This is my code: ````` #include <stdio.h> int main() { char name[20], answer[5]; do{ printf("Name: "); fgets(name, 20, stdin); printf("Your name is %s", name); printf("Do you want to add another name? "); scanf("%s", answer); } while (strcmp(answer, "yes")==0); return 0; } ``````````