Coding Practice

Write a C program to input any character and check whether it is alphabet, digit or special characters

Check alphabet, digit or special characters
Sample Output
Enter here: @

@ is special character.

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

int main()
{
    char ch;

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

    if(ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z')
    {
        printf("\n%c is alphabet.\n", ch);
    }
    else if(ch >= '0' && ch <= '9')
    {
        printf("\n%c is digit.\n", ch);
    }
    else
    {
        printf("\n%c is special character.\n", ch);
    }
    return 0;
}
Sample Output
Enter here: a

a is alphabet.

Process returned 16 (0x10)   execution time : 0.922 s
Press any key to continue.
Change Theme
X