C# Sharp Exercises: Check whether a character is an alphabet or not and if so, check for the case
C# Sharp String: Exercise-18 with Solution
Write a program in C# Sharp to check whether a character is an alphabet and not and if so, go to check for the case.
Sample Solution:-
C# Sharp Code:
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");
}
}
}
Sample Output:
Check whether a character is alphabet or not and if so, check for case : ----------------------------------------------------------------------------- Input a character: a The character is lowercase.
Flowchart:
C# Sharp Code Editor:
Contribute your code and comments through Disqus.
Previous: Write a program in C# Sharp to search the position of a substring within a string.
Next: Write a program in C# Sharp to find the number of times a substring appears in the given string.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework