Monday, April 4, 2016

Check Vowel using Switch Case in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
    class class1
    {
        static void Main(string[] args)
        {
            char c;
            Console.WriteLine("Enter the Charachter to chech it is vowel or not");
            c = char.Parse(Console.ReadLine());
            Console.WriteLine("please wait searching ........");
            System.Threading.Thread.Sleep(2000);
            switch (c)
            {
                case 'a':
                case 'A':
                case 'E':
                case 'e':
                case 'I':
                case 'i':
                case 'o':
                case 'O':
                case 'u':
                case 'U':
                    Console.WriteLine("{0} is a vowel", c);
                    break;
                default: Console.WriteLine("{0} is not a vowel", c);
                    break;
            }
            Console.ReadKey();
        }
    }

No comments:

Post a Comment