programming-examples/c-sharp/Strings/C# Sharp to check whether a character is an alphabet and not and if so, go to check for the case.cs

26 lines
897 B
C#
Raw Normal View History

2019-11-15 12:59:38 +01:00
using System;
public class Exercise18
{
static void Main()
{
Console.Write("\n\nCheck whether a character is alphabet or not and if so, check for case :\n");
Console.Write("-----------------------------------------------------------------------------\n");
Console.Write("Input a character: ");
char ch = (char)Console.Read();
if (Char.IsLetter(ch))
{
if (Char.IsUpper(ch))
{
Console.WriteLine("\nThe character is uppercase.\n");
}
else
{
Console.WriteLine("\nThe character is lowercase.\n");
}
}
else
{
Console.WriteLine("\nThe entered character is not an alphabetic character.\n");
}
}
}