Answer the question
In order to leave comments, you need to log in
Is the macro problem solved correctly?
Write a program containing macros with arguments that calculate the areas of various geometric shapes (for example, a square, a rectangle, a circle).
My decision:
#include <stdio.h>
#define SQ(a) (a) * (a)
#define REC(a,b) (a) * (b)
#define CIR(r) 3.14 * (r) * (r)
main () {
printf("%d\n", SQ(67));
printf("%d\n", REC(8,9));
printf("%.2f\n", CIR(5));
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question