A program to explain NESTED MACROS
C Programming Language 098
- Write a program to explain NESTED MACROS
Program
#include <stdio.h>
#define square(x) (x * x)
#define cube(y) (y * y * y)
#define sixth(z) (square(cube(z)))
void main()
{
int side;
int a;
float area, b;
printf("Enter values: ");
scanf("%d %d", &a, &side);
area = square(a);
b = sixth(side);
printf("\n%f\n%f", area, b);
printf("\n");
}
Result
Enter values: 2 3
4.000000
729.000000
Last Updated on
Comments