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 ciExplanation / 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
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.