I am having a hard time comparing my if else statements and getting it right. I want to ask for male or female, and if male then I can respond "Hello, Mr...." and if it is female then I can respond "Hello, Mrs...."
#include <stdio.h>
int main (void){
int firstNum;
char name[25];
char gender[5];
printf("Please enter your full name: ");
fgets(name, 50, stdin);
printf("Please enter your gender (Male or Female): ");
fgets(gender, 5, stdin);
printf("Please enter your age: ");
scanf("%d", &firstNum);
if (firstNum<18){
printf("Please go home now.\n");
}
else{
if(strcmp(gender,"male"))
{
printf("Hi, Mr. %s\bWelcome and Enjoy!\n", name);
}
else(strcmp(gender,"female"));
{
printf("Hi, Mrs. %s\bWelcome and Enjoy!\n", name);
}
}
printf("Name: %sAge: %d\n", name, firstNum);
getchar();
}