1. ## Defines and Header file

1. Write a program the calculates the volume of a sphere. Use a define to set Pi to 3.14 and a macro for the formula for the sphere. V = 4/3PiR3.
In main ask for the radius (R). Pass it to a function where you calculate the volume and return it to main and print the volume in main. Use float values. (Save this program as you'll need it later.)

Code:

Code:
```#include<stdio.h>
void fun (float);
main()
{
float  a;
float v;
scanf("%.3f",&a);
fun(a);
printf("The volume is  =  %.3f", v);
}

{
float v,pi = 3.14;
printf("%.3f",v);
return(v);
}```

What sort of help do you need?

3. You've got the basic idea.

fun calcuates the volume of sphere, given a radius. But it shouldn't be called "fun". It should be called "spherevolume" or somethign similar.

Then it's one of those functions which returns a single value, like tan or sqrt. So it should be float fun(float r).

Finally, it depends on the mathematical constant PI. In C we define constants with the #define directive. For instance phi, the golden ratio, is a constant. So you could write
#define PHI 1.618

Another constant you use a lot is INT_MAX, the maximum value that can be held in an integer. This is defined for you in limits.h, or you can define a similar constant yourself.

5. Code:
```#include<stdio.h>
#include<limits.h>
#define pi 3.141592654
void spherevolume (float a);
main()
{
float a,v;
scanf("%f",&a);
spherevolume(a);
printf("%f",v);
getch();
}
void spherevolume (float b)
{
num = 1.333333333;
Radius = b * b * b;
v = (num * pi * Radius);
return(v);
getch();

}```

6. Look up Preprocessor commands. That's what you need to use.

You want the volume thing to not be a function. you need to use #define for a macro as well.

7. @The Doctor

Code:
```if (codeWorks( code) && !youCanDoSomethingBetter( code) )
{
fix( code);
} else
{
beHappy();
}```
Fix your signature! You have the statements reversed!

Code:
```if (codeWorks( code) && !youCanDoSomethingBetter( code) )
{
beHappy();
} else
{
fix( code);
}```

How about making it return something?

> void spherevolume (float a);
Like say
float spherevolume (float a);

Then make sure you assign the result in main rather than ignore it.

9. Code:
```#include<stdio.h>
#include<limits.h>
#define pi 3.141592654
float spherevolume (float);
main()
{
float a,v;
scanf("%f",&a);
v = spherevolume(a);
printf("\n\nThe volume is : %.3f",v);
getch();
}
float spherevolume (float b)
{