C Programto identify wheather the entered character is a letter ar digit and capital or small using predefined macros

#include”stdio.h”
#include”conio.h”
#include”ctype.h”
void main()
{
char d;
int f;
clrscr();
printf(“\n Enter any character: “);
d=getche();
f=isaplha(d);
if(f!=0)
{
printf(“\n %c is a letter in “,d);
f=isupper(d);
if(f!=0)
printf(“Capital Case”);
else
printf(“Small Case”);
}
else
{
f=isdigit(d);
if(f!=0)
printf(“\n %c is a digit”,d);
else
{
f=ispunct(d);
if(f!=0)
printf(“\n %d is a punctuation symbol”,d);
}
}
getche();
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s