Write a C program to check whether a character is an alphabet, digit or special character.



#include <stdio.h>
#include <conio.h>
void main()
{

    char u;
    printf("enter any character: ");
    scanf("%c", &u);
    if ((u >= 'a' && u <= 'z') || (u >= 'A' && u <= 'Z'))

    {
        printf("this is a alphabet");
    }
    else if (u >= '0' && u <= '9')
    {
        printf("its a digit");
    }
    else
    {
        printf("this is a special character");
    }
}


OUTPUT 
Enter any alphabets: s
this is an alphabet.

Follow our page for regular updates.

0 Comments