To check whether the given number is alphabet or digit or special character

 Program:


#include<stdio.h>
#include<conio.h>
void main()
{
    char ch;
    clrscr();
    printf("Enter any Character : ");
    scanf("%c", &ch);
    if((ch>=65 && ch<=90) || (ch>=97 && ch<=122))
        printf("Given Character is a Alphabet");
    else if(ch>='0' && ch<='9')
        printf("Given Character is a Digit ");
    else
        printf("Given character is a Special Character");
    getch();
}


Output:

Ex-1:
Enter any Character : a
Given Character is a Alphabet

Ex-2:
Enter any Character : A
Given Character is a Alphabet

Ex-3:
Enter any Character : 1
Given Character is a Digit

Ex-4:
Enter any Character : @
Given Character is a Special Character



Next Topic        :  

Previous Topic :

No comments:

Post a Comment