Check Uppercase and Lowercase Character C Program

By | December 6, 2015

C Program To Check Uppercase and Lowercase Character

Learn How To Check Uppercase and Lowercase Character in C Programming Language. We have mentioned Two different Methods To Check Lowercase and Uppercase Characters.

The First method consists of Built-In Library Functions such as islower() and isupper() which are declared under <ctype.h> Header file. The Second Method checks Characters for its Case by using ASCII Values. It checks for particular range of ASCII Values.

Also Read: C Program To Check ASCII Values and Character

Method 1: C Program To Check Uppercase and Lowercase Character using Library Functions

#include<stdio.h>
#include<ctype.h>

int main()
{
    char ch;
    printf("\nEnter A Character:\t");
    scanf("%c", &ch);
    if(islower(ch))
        printf("\n%c is a Lower Case Character\n", ch);
    else if(isupper(ch))
        printf("\n%c is a Upper Case Character\n", ch);
    return 0;
}

Method 2: C Program To Check if Character is Uppercase or Lowercase using ASCII Values

#include<stdio.h>

int main()
{
    char ch;
    printf("\nEnter A Character:\t");
    scanf("%c", &ch);
    if(ch >= 65 && ch <= 90)
        printf("\n%c is a Upper Case Character\n", ch);
    else if(ch >= 97 && ch <= 122)
        printf("\n%c is a Lower Case Character\n", ch);
    return 0;
}

Also Read: C Program To Convert Lowercase into Uppercase Character and vice-versa

 

Output

Check Uppercase and Lowercase Character in C

Also Read: C Program Code To Character is Alphabet or Digit

 

If you have any compilation errors or doubts in this C Program To Check Uppercase and Lowercase Character using ASCII Values, let us know about in the Comment Section below.

Let's Discuss