I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability.
using System;
class Program
{
static void Main(string[] args)
{
char gender;
//Reading gender from user
Console.WriteLine("Enter gender (M/m or F/f): ");
gender = Convert.ToChar(Console.ReadLine());
// checking vowel and consonant
switch (gender)
{
case 'M':
case 'm': Console.WriteLine("MALE");
break;
case 'F':
case 'f': Console.WriteLine("FEMALE");
break;
default: Console.WriteLine("Unspecified Gender");
break;
}
Console.ReadLine();
}
}
I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability.
Result:
Enter gender (M/m or F/f):
M
MALE
need an explanation for this answer? contact us directly to get an explanation for this answer