Wednesday 23 April 2014

C# program to check whether a input character is vowel or not using switch statement

ENGLISH VOWELS A,E,I,O,U.


SOURCE CODE :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace switchcase1
{

    class switch1
    {
        public void switchcase1()
        {
            string str = "";
            Console.WriteLine("\nEnter a character to check vowel or not");
            str = Console.ReadLine();
            Console.WriteLine(str);
            switch (str.ToLower())
            {
                case "a":
                case "e":
                case "i":
                case "o":
                case "u":

                    Console.WriteLine("Vowel");
                    Console.ReadLine();
                    break;
                default:
                    Console.WriteLine("Not a Vowel");
                    Console.ReadLine();
                    break;
            
            }
        }

    }
        class Program
        {
            static void Main(string[] args)
            {
                switch1 s = new switch1();
                s.switchcase1();

            }
        }
   
}







                        OUTPUT:
Enter a character to check vowel or not
a

a

its a vowel



No comments:
Write comments

Featured post

List of Universities in Karnataka offering M.Sc Computer Science

The post-graduate programme in Computer Science (M.Sc Computer Science) contains two academic years duration and having a four semesters....

Popular Posts

Copyright @ 2011-2022