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

can any one tel me wt is the question pattern for NIC exam

1560


Explain function?

666


When should a type cast be used?

577


What are the types of macro formats?

613


What is a void * in c?

602






the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....

22244


What are the 5 elements of structure?

573


Is c is a low level language?

568


design and implement a data structure and performs the following operation with the help of file (included 1000 student marks in 5 sub. and %also) 1.how many students are fail in all 5 subjects (if >35) 2. delete all student data those are fail in all 5 subjects. 3. update the grace marks (5 no. if exam paper is 100 marks) 4. arrange the student data in ascending order basis of marks. 5.insert double of deleted students with marks in the list.

1501


Explain a pre-processor and its advantages.

637


How do I swap bytes?

634


Explain what is the benefit of using #define to declare a constant?

614


Write a program to generate random numbers in c?

666


What is header file in c?

607


What are the advantage of c language?

556