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
What are header files in c?
Write a program to print fibonacci series using recursion?
Explain what is page thrashing?
given post order,in order construct the corresponding binary tree
What are the advantages of union?
What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?
What language is windows 1.0 written?
Is array a primitive data type in c?
Which node is more powerful and can handle local information processing or graphics processing?
What will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
Explain what are bus errors, memory faults, and core dumps?
What is preprocessor with example?
How can I get the current date or time of day in a c program?
When should we use pointers in a c program?
What are register variables? What are the advantage of using register variables?