Write C# Program to check whether alphabet is vowel or consonant using switch case

Algorithm:-

(1)Start

(2)Take  character(alphabet) from user

(3)compare these character with all upper and lower case vowel

(4)if condition is true true then  print character is vowel else character is consonant

(5)stop


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;


namespace VowelCheckFromChar_2_

{

    class Program

    {

        static void Main(string[] args)

        {

            char ch;

            Console.Write("Input an Alphabet (A-Z or a-z) : ");

            ch = Convert.ToChar(Console.ReadLine().ToLower());

            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.ReadKey();

        }

    }

}

Output:- 

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

The Alphabet is vowel

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

The Alphabet is not a vowel


एक टिप्पणी भेजें

0 टिप्पणियाँ