Uppercase Lowercase & Special Character
When a user enters a character, the system has to check wheatear it is uppercase, lower case or a special character. For instance, if the entered character is a, it is of the lower case. If the user enters A, it is of upper case, and if the user enters 0, it is a special character.
Algorithm to check whether the entered character is Uppercase, Lowercase or Special Character
Step 1. Start
Step 2. Enter a character
Step 3. Check whether the character lies between A to Z, if true, print “it is an uppercase letter.”
Step 4. Check whether the character lies between a to z, if true, print “it is a lowercase letter.”
Step 5. If none of the above conditions is fulfilled, print “it is a special character”
Step 6. Stop
C Program to check wheatear the entered character is Uppercase, Lowercase or Special Character
// C program to check a character
#include
void PrepInsta(char ch)
{
if (ch >= 'A' && ch <= 'Z') printf("\n%c is in upper case ", ch); else if (ch >= 'a' && ch <= 'z')
printf ("\n%c is in lower case ", ch);
else
printf ("\n%c is not an alphabet",
ch);
}
// Driver Code
int main()
{
char ch;
// Entering the character
ch = 'A';
// Check the character
PrepInsta(ch);
// Get the character
ch = 'a';
// Check the character
PrepInsta(ch);
// Get the character
ch = '0';
// Check the character
PrepInsta(ch);
return 0;
}
Output
S is an upper case character g is a lower case character 9 is not an alphabet

Login/Signup to comment