C# Program to Check Whether a Character is a Vowel or Consonant

In this C# program, we will take the input from the user and Check Whether a Character is a Vowel or Consonant.

C# Program to Check Whether a Character is a Vowel or Consonant Code:

private static void Main(string[] args)
        {
            char[] vowels = { 'a', 'e', 'i', 'o', 'u' };
            Console.Write("Enter a character : ");
            char input = char.Parse(Console.ReadLine().ToLower());
            if (Array.IndexOf(vowels, input) > -1)
            {
                Console.Write("Entered character {0} is a Vowel",input);
            }
            else
            {
                Console.Write("Entered character {0} is not a Vowel", input);
            }

            Console.ReadLine();
        }

C# Program to Check Whether a Character is a Vowel or Consonant Output:

CSharp-Program-to-Check-Whether-a-Character-is-a-Vowel-or-Consonant

 
About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2024 CodingFusion
50+ C# Programs for beginners to practice