All Type Coding

Search Here

How do I find that the alphabet is a vowel or consonant in c#.?

using System;
class abc
{
    char a;
    public void fun()
    {
        Console.WriteLine("Enter the alphabet to find it is a vowel or a consonant");
        a = Convert.ToChar(Console.ReadLine());
        if (a == 'a' || a == 'i' || a == 'o' || a == 'e' || a == 'u' || a == 'A' || a == 'I' || a == 'O' || a == 'E' || a == 'U')
        {
            Console.WriteLine("You had entered is a vowel");
        }
        else
        {
            Console.WriteLine("You had entered is a consonant");
        }
        Console.ReadKey();
    }
}
class vocon
{
    public static void Main(string[] args)
    {
        abc a1 = new abc();
        a1.fun();
    }
}
Output:



No comments :

Post a Comment