write a program to check whether inputted alphabet is vowel or not using switch case
using System;
namespace Question
{
class Program
{
static void Main(string[] args)
{
ConsoleKeyInfo key;
do
{
Console.Clear();
Console.WriteLine("Input your alphabet symbol(ESC - exit): ");
key = Console.ReadKey();
if (key.Key == ConsoleKey.Escape) return;
Console.WriteLine();
switch(char.ToLower(key.KeyChar))
{
case 'e': Console.WriteLine("Inputed alphabet symbol is vowel");break;
case 'y': Console.WriteLine("Inputed alphabet symbol is vowel");break;
case 'i': Console.WriteLine("Inputed alphabet symbol is vowel");break;
case 'o': Console.WriteLine("Inputed alphabet symbol is vowel");break;
case 'a': Console.WriteLine("Inputed alphabet symbol is vowel");break;
default: Console.WriteLine("Inputed alphabet symbol isn`t a vowel");break;
}
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
}while(true);
}
}
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
C#