C Program for finding whether a character is in Uppercase, Lowercase, is a special character or a digit.

Finding whether a Character is Uppercase, Lowercase or Special Character.

In this article, we’ll learn about, how to find out that the character that has been entered by the user is an Uppercase Letter, a Lowercase Letter or a Special Character. The above can be achieved by comparing the ASCII Code (American Standard Code for Information Exchange) of the corresponding input character. For example, ASCII Code for small letter starts from 97 for ‘a’ and ends at 122 for ‘z’. There’s a difference of 32. 

C Program for Uppercase, Lowercase or Special Character



  • Take the input from the user.
  • Use Conditional Statements (If-Else) to determine the range of the ASCII Code for the corresponding Input Character.
  • Write print statements in the respective conditional blocks.

C Program

#include <stdio.h>
int main()
    char c;
    printf("Enter a Character\n");
	    if(48<=c && c<=57)
	        //using ascii codes of digit where 0-48 and 9-57
	    else if(65<=c && c<=90)                  
	        //using ascii codes of Uppercase letters where A-65 and Z-90
	        printf("Uppercase Letter");
	    else if(97<=c && c<= 122)           
	        //using ascii codes of Lowercase letters where a-97 and z-122
	        printf("Lowercase Letter");
	        //Rest of the characters ie. special characters

	        printf("Special Character");
    return 0;