Sunday, 15 December 2013

C# program to check the character is vowel or not



In this article we will discuss with you the program for checking whether character is vowel or not using console application in c#.net using for loop:
Step1: Take a new console application using c# as a language in the Visual studio.
Step2: Declare a variable “str_Name” and take the input of the character which you want to test.
Step3: Now check if it is anything from the A,E,I,O,U then it is a vowel otherwise it’s not vowel.


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

namespace vowel
{
    class Program
    {
        static void Main(string[] args)
        {
            string str_Name;

            Console.WriteLine("Please enter The charcater to check whether it is vowel or not");
            str_Name = Console.ReadLine();


            if ((str_Name == "A") || (str_Name == "E") || (str_Name == "I") || (str_Name == "O") || (str_Name == "U")
                || (str_Name == "a") || (str_Name == "e") || (str_Name == "i") || (str_Name == "o") || (str_Name == "u"))
            {
                Console.WriteLine("The charcater is vowel");
            }
            else
            {
                Console.WriteLine("The charcater is not vowel");
            }

            Console.ReadLine();
        }
    }
}
Output:-


No comments:

Post a Comment