C Program using predefined macros

#include”stdio.h”
#include”conio.h”
void main()
{
clrscr();
#ifdef __TINY__
printf(“\n TINY %d”,__TINY__);
#else
#ifdef __SMALL__
printf(“\n SMALL %d”,__SMALL__);
#else
#ifdef__MEDIUM__
printf(“\n MEDIUM %d”,__MEDIUM__);
#endif
#endif
#endif
getch();
}

Advertisements

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();
}