Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the #define preprocessor directive and declarations for a program that has

ID: 3789156 • Letter: W

Question

Write the #define preprocessor directive and declarations for a program that has a constant macro for PI ( 3.14159) and variables radius , area , and circumf declared as double , variable num_circ as an int , and variable circ_name as a char. Please give me the code to just copy and paste and done.

I have this but it tells me unsuccessful build and i have no idea why

// Constant macro for PI

#define PI 3.14159

void main() {

double radius;
double area;
double circumf;
int num_circ ;
char circ_name;

}

lool Constant trac:o fo: PI ce PI 3.1 15 double rad Juuble ares: double circum f int num ci

Explanation / Answer

#include<stdio.h>
#define PI 3.14159
int main(int argc, char const *argv[])
{
   /* code */
   double radius;
double area;
double circumf;
int num_circ ;
char circ_name;
printf("Value of PI is %lf ",PI );
   return 0;
}

===================================================

Output:

akshay@akshay-Inspiron-3537:~/Chegg$ gcc piconts.c
akshay@akshay-Inspiron-3537:~/Chegg$ ./a.out
Value of PI is 3.141590

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote