Q:

Write C# Program to Check whether an alphabet is a vowel or not

0

Write C# Program to Check whether an alphabet is a vowel or not.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability..

using System;
 
public class exercise17
{
    static void Main(string[] args)
    {
        char ch;      
 
        Console.Write("Input an Alphabet (A-Z or a-z) : ");
        ch = Convert.ToChar(Console.ReadLine().ToLower());
        int i = ch;
        if (i >= 48 && i <= 57)
        {
            Console.Write("You entered a number, Please enter an alpahbet.");
        }
        else
        {
            switch (ch)
            {
                case 'a':
                    Console.WriteLine("The Alphabet is vowel");
                    break;
                case 'i':
                    Console.WriteLine("The Alphabet is vowel");
                    break;
                case 'o':
                    Console.WriteLine("The Alphabet is vowel");
                    break;
                case 'u':
                    Console.WriteLine("The Alphabet is vowel");
                    break;
                case 'e':
                    Console.WriteLine("The Alphabet is vowel");
                    break;
                default:
                    Console.WriteLine("The Alphabet is not a vowel");
                    break;
            }
        }
        Console.ReadLine();
    }
}

Result:

Input an Alphabet (A-Z or a-z) : A

The Alphabet is vowel

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write C# Program to check number is positive, nega... >>
<< Write C# Program to check leap year using conditio...