C# - Check if a character is a vowel or not
C# - Check if a character is a vowel or not
CODE
using System;
class Program
{
public static void Main()
{
string character = "c";
character = character.ToLower();
if(character == "a" || character == "e" || character == "i" || character == "o" || character == "u")
Console.WriteLine("The character '{0}' is a vowel.", character);
else
Console.WriteLine("The character '{0}' is not a vowel.", character);
Console.ReadKey();
}
}
Comments
Post a Comment