Easy Tutorial
❮ C Function Abs C Examples Printf Int ❯

C Language Example - Check if a Character is an Alphabet

C Language Examples

The user inputs a character, and the program checks whether the character is an alphabet letter.

Example

#include <stdio.h>

int main()
{
    char c;
    printf("Enter a character: ");
    scanf("%c", &c);

    if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
        printf("%c is an alphabet letter", c);
    else
        printf("%c is not an alphabet letter", c);

    return 0;
}

Execution Result:

Enter a character: a
a is an alphabet letter

C Language Examples

❮ C Function Abs C Examples Printf Int ❯