C Program to Print Gender

Write C Program to Print Gender

//WAP to print the gender

#include <stdio.h>

int main()
{
	char c;

	printf("Enter F for female, M for male and O for others :--> ");
	scanf("%c", &c);

	if(c == 'F'|| c == 'f')
	{
		printf("Your gender is Female");
	}
	else if (c == 'M'|| c == 'm')
	{
		printf("Your gender is Male");
	}
	else if(c == 'O'|| c == 'o')
	{
		printf("Your gender is Others");
	}
	else
	{
		printf("Please give the right input..");
	}
	return 0;

}

Output:

Run 1:
Enter F for female, M for male and O for others :--> M
Your gender is Male

Run 2:
Enter F for female, M for male and O for others :--> f
Your gender is Female

Run 3:
Enter F for female, M for male and O for others :--> 0
Please give the right input..

≪ Previous | Next ≫