C Program to Check Whether a Character is Uppercase or not

Program

Read C Program to Check Whether a Character is Lowercase or not article to understand the concept in detail.


	
#include<stdio.h>
#include<conio.h>

int main()
{
	 char ch;
	 clrscr();
	 printf("Enter chracter: ");
	 scanf("%c", &ch);
	
	 if(ch>='A' && ch<='Z') // or if(ch>=65 && ch<=90)
	 {
	  	printf("%c is UPPERCASE.", ch);
	 }
	 else
	 {
	  	printf("%c is NOT UPPERCASE.", ch);
	 }
	
	 getch();
	 return(0);
}

Output of the above program :

Run 1:
----------
Enter any character: f ↲
f is NOT UPPERCASE.

Run 2:
----------
Enter any character: G ↲
G is UPPERCASE.

Run 3:
----------
Enter any character: * ↲
* is NOT UPPERCASE.

Note: ↲ indicates ENTER is pressed.