In this tutorial learn how you can display whether you are Mr or Miss given your gender as input. Here we are using the if statement.
C programming is a powerful general-purpose programming language. It can be used to develop software like operating systems, databases, compilers, etc.
Here is the code to display whether you are Mr or Miss given your gender as input in C programming.
#include <stdio.h> //WAP to display whether you are Mr or Miss given your gender as input.
int main(){
char gender;
printf("Please enter your gender,M/F:");
scanf("%c",&gender);
if(gender=='M' || gender == 'm')
printf("You are Mr.");
else printf("You are Miss.");
return 0;
}
This is how you can display whether you are Mr or Miss given your gender as input. in C programming. Comment below if you like our tutorial.