C program to check enter alphabet is upper case or lower case using conditional operator.
C program to check enter alphabet is upper case or lower case using conditional operator
#include <stdio.h>
int main()
{
char ch;
printf("\n Enter any character: ");
scanf("%c", &ch);
(ch >= 'A' && ch <= 'Z')?
printf("\n %c It is uppercase case alphabet .", ch):
(ch >= 'a' && ch <= 'z')?
printf("\n %c It is lowercase case alphabet.", ch):
printf("\n %c It is not an alphabet.", ch);
return 0;
}
Output:
Enter any character: Q
Q It is uppercase case alphabet .
Enter any character: q
q It is lowercase case alphabet.
Enter any character: 8
8 It is not an alphabet.