33. C Program To Learn how to read a character and finding uppercase or lowercase.
How does this program work?
- In this program your going to learn about how to scan a character.
- And How to Check the case of the letter.
- Whether it is Lowercase or Uppercase.
Here is the code
#include <stdio.h>
int main(void)
{
char ch;
//User input
printf("Enter any character: \n");
scanf("%c", &ch);
//By usign if case we finding case of a character
if(ch >= 'A' && ch <= 'Z')
{
printf(" '%c' is uppercase alphabet.", ch);
}
else
if(ch >= 'a' && ch <= 'z')
{
printf(" '%c' is lowercase alphabet.", ch);
}
else
{
printf(" '%c' is not an alphabet.", ch);
}
return 0;
}