jae-l
5/30/2017 - 4:28 PM

Example using an if else to determine if a char is lowercase or uppercase. From the Microsoft C# Reference https://docs.microsoft.com/en-us/

Example using an if else to determine if a char is lowercase or uppercase. From the Microsoft C# Reference https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/if-else

Console.Write("Enter a character: ");
char c = (char)Console.Read();
if (Char.IsLetter(c))
{
  if (Char.IsLower(c))
  {
    Console.WriteLine("The character is lowercase.");
  }
  else
  {
    Console.WriteLine("The character is uppercase.");
  }
}
else
{
  Console.WriteLine("The character isn't an alphabetic character.");
}

//Sample Output:

//Enter a character: 2
//The character isn't an alphabetic character.

//Enter a character: A
//The character is uppercase.

//Enter a character: h
//The character is lowercase.