C Sharp Program to check if a character is vowel or consonant



Below is the Program to check whether entered character is vowels or consonant.


using System;

namespace Vowels_consonant

{

       class Program

       {

        static void Main(string[] args)

        {

         char c;

         Console.WriteLine("Please Enter the chatacter");

       &nbsp c = Convert.ToChar(Console.ReadLine());

         if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')

         {

          Console.WriteLine("Entered chahrater is vowel");

          Console.ReadKey();

         }

         else

         {           Console.WriteLine("Entered chahrater is Consonant");

          Console.ReadKey();

         }

        }

       }

}

Output.

Please enter a character.

a

Entered chahrater is vowel.

Please enter a character.

d

Entered chahrater is consonant.

C Sharp Program to check if a character is vowel or consonant C Sharp Program to check if a character is vowel or consonant Reviewed by LanguageExpert on August 19, 2017 Rating: 5

No comments