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.


write c program to display whether you are mr or miss given your gender as input




Write a Program to Display Whether You are Mr or Miss Given Your Gender as Input

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;
}

Test Live At Jdoodle


Conclusion

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.