C Program To Accept A Character And Determine Whether It’s Upper Case Or Lower Case.
Q17. Write a C program to accept a character and determine whether it’s upper case or lower case.
Solution:
#include<stdio.h> //standard input/output header file
#include<conio.h> //for clrscr()
int main()
{
char a;
clrscr(); //for clearing the screen
printf(“\n Enter any character: “);
scanf(“%c”,&a);
a>=90?printf(“\n It is a lower case letter.”) :printf(“\n It is an upper case letter.”);
getch(); //holds the screen until any key is pressed
return 0; //makes main() finish
}
OUTPUT:
CASE 1:
Enter any character: r
It is a lower case letter.
CASE 2:
Enter any character: R
It is an upper case letter.