- Write a macro definition to test whether a character entered is a small case letter or not.
- Write a macro definition to test whether a character entered is a upper case letter or not.
- Write a macro definition to test whether a character entered is a alphabet or not. use the macro defined in 1 and 2.
- Write a macro definition to obtain the bigger of two numbers.
- Write macro definitions with arguments for calculation of area and perimeter of a triangle,a square and a circle.
- Write a macro definition to find arithmetic mean of two numbers.
- Write a macro definition to find absolute value of a number.
- Write a macro definition to convert a uppercase alphabet to lowercase
- Write macro definitions with arguments for calculation of Simple Interest and amount.
- Define a macro swap(t,x,y) that interchanges two arguments of type t.
Pages
The greatest mistake you can make in life is to be continually fearing you will make one
Monday, 1 March 2010
C programs based on Preprocessor
Labels:
C Programs
Subscribe to:
Post Comments (Atom)
it's cool but i need the answers
ReplyDeletepls...
for the 10th question i coded this.. Can any1 tell me whether its the right way to to do so?? i am a beginner....
ReplyDelete//macro to swap two vars
#include < stdio.h >
#include < conio.h >
#define SWAP(t,m,n) t=m; m=n; n=t;\
printf("\nAfter swaping m=%d,n=%d",m,n);
void main(){
clrscr();
int m=3,n=4;
int a;
printf("\n before swap m and n are %d %d",m,n);
SWAP(a,m,n);
getch();
}
Hi,
ReplyDeleteIn the 10th question "t" is the data type and not the temp variable. t may be int,char,float or double.