Program to check whether the given character is a alphabet,digit or a special character
#include <stdio.h>
#include <conio.h>
void main()
{
char ch;
clrscr();
printf("Enter Character : ");
scanf("%c",&ch);
if(isalpha(ch)) //isalph() is used to check whether the character is a alphabet
{
printf("\nAlphabet is Entered");
if(isupper(ch)) //isupper() is used to check whether the character is upper case
{
printf("\n\nIt is Upper Case");
}
else if(islower(ch)) //islower() is used to check whether the character is lower case
{
printf("\n\nIt is Lower Case");
}
}
else if(isdigit(ch)) //isdigit() is used to check whether the character is a digit
{
printf("\nDigit is Entered");
}
else
{
printf("\n\nSpecial Character");
}
getch();
}
Output :

0 comments:
Post a Comment