Write a c program to write macro definition To test whether a character is lowercase or not To check whether a character is alphabet or not To obtained the largest of two numbers

#include<stdio.h>
#include<conio.h>
#include<ctype.h>
#include<string.h>
#define LOWER(ch) (ch>=97&&ch<=122 ? printf("\nlower"):printf("\n not lower"))
#define ALPHA(ch) (isalpha (ch) ? printf("\n alphabet"):printf("\n not alphabet"))
#define LARGE(a,b) (a>b ? printf("\n a is greater"):printf("\n b is greater"))
void main()
{
char ch;
int a,b;
clrscr();
printf("\n enter the character=");
scanf("%c",&ch);
printf("\n enter the two number =");
scanf("%d%d",&a,&b);
LOWER (ch);
ALPHA (ch);
LARGE (a,b);
getch();
}

No comments:

Post a Comment