Coding Practice

Write a C program to check whether a character is uppercase or lowercase alphabet

Check a character is uppercase or lowercase alphabet
Sample Output
Enter a character: p

p is lowercase alphabet.

Process returned 0 (0x0)   execution time : 1.219 s
Press any key to continue.
Source Code
#include<stdio.h>

int main()
{
    char ch;

    printf("Enter a character: ");
    scanf("%c", &ch);

    if(ch >= 'a' && ch <= 'z')
    {
        printf("\n%c is lowercase alphabet.\n", ch);
    }
    else if(ch >= 'A' && ch <= 'Z')
    {
        printf("\n%c is uppercase alphabet.\n", ch);
    }
    else
    {
        printf("\nInvalid Alphabet!\n");
    }
    return 0;
}
Sample Output
Enter a character: M

M is uppercase alphabet.

Process returned 0 (0x0)   execution time : 2.789 s
Press any key to continue.
Change Theme
X