Write a c program to Find the name that you entered is male
name or female name?

Such as Sunjay is name of male and Payal is name of female

Answer Posted / deepak kishore

it's not possible to right answer in 100% cases.
But in 80% cases answer will be right.
Ans in C#.

Console.WriteLine("Enter your Name to get gender");
string s = Console.ReadLine();

int len = s.Length;

char c =s[ len - 1];

if (c == 'a' || c=='A')
{
Console.WriteLine("Female");
}
else if (c == 'e' || c=='E')
{
Console.WriteLine("Female");
}
else if (c == 'i' || c=='I')
{
Console.WriteLine("Female");
}
else if (c == 'o' || c=='O')
{
Console.WriteLine("Female");
}

else if (c == 'u' || c=='U')
{
Console.WriteLine("Female");
}

else
{
Console.WriteLine("Male");
}

Console.ReadLine();


deepak.sonu786@gmail.com

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I determine whether a character is numeric, alphabetic, and so on?

614


Why do we write return 0 in c?

542


1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. The Logic should be written in Data Structures?

1904


How do I use strcmp?

628


What is the difference between c and python?

572






what are the facialities provided by you after the selection of the student.

1649


Why can’t we compare structures?

801


What is typeof in c?

596


What is the difference between strcpy() and memcpy() function in c programming?

616


What is pre-emptive data structure and explain it with example?

3200


When should the register modifier be used? Does it really help?

598


main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }

901


What is getch c?

843


What is the importance of c in your views?

584


Why main is not a keyword in c?

637