Friday, October 1, 2010

C program to check the given input character is Upper case, Lower case and digit.

//to check if entered character is uppercase or lowercase
//alphabet or is a digit
main()
{
char a;
printf("Enter the character\n");
a=getchar();
if(isalpha(a))
{
printf("It is a Alphabet\n");
if(isupper(a))
{
printf("It is in upper case\n");
}
else
{
printf("It is in lower case\n");
}
}
else if(isdigit(a))
{
printf("It is a digit\n");
}
system("pause");
}

No comments:

Post a Comment

Google+ Followers