1. ## help with writing function that multiplys the radius

Just like to say hi to everybody and that umm this is basically my first semester of programming its been pretty fun and its always cool learning new things.

Teach wanted us to write a program that did a couple of things.

1. prompt the user for the radius in main *did that*
2. use this formula to find the diameter 2r (2 * radius)
3. use this formula to find the circumference 2pi r(2*pi*radius)
4. use this formula to find the circle pi rē (pi * r * r)
5. use a seperate function for each calculation and print the answers from main.

What I need help is figuring out how do I go about coding this program. Im stuck at part 2 because I dont know what to do next. here is my code.

Code:
```/* The purpose of this program is to read in the radius and print out
the circle's diameter, circumference, and area */

#include <stdio.h>
#include <conio.h>
#define PI 3.14159

void main()

/* This function asks the user to type in a number for the radius of a circle */

{

getch();
}

/* This function lists the diameter of the number inputed as the radius of the circle */

so for the 2nd function do I start off by writing the formula in ?

2. You'll need three functions like this :
Code:
```float function(float radius)
{
return whatever;
}```
You have the formulae, so just plonk in it the function as the return value.

Here's an example:
Code:
```float circumference(float radius)
{
}```
You will also need to declare the functions before main().
Code:
```#include <stdio.h>
#include <conio.h>
#define PI 3.14159

int main()
{
..
..
..
return 0;
}```
To print the values in main(), just print the return value of the function, eg.
Code:
`printf("circumference = %f", circumference(radius));`
Oh, and don't use void main(), use int main() and then return 0 at the end.

3. Hey Dog, I felt like saying this:
http://www.yourethemannowdog.com/

4. thanks for your help. I was doing just the opposite, instead of declaring the functions before main, I was writing them in after main.

I just have one problem, I keep getting the same 3 syntax errors. What does this mean

error C2297: '*' : illegal, right operand has type 'int (__cdecl *)(int)'

it errors on this part of the code

Code:
`return(PI * radius * radius);`

5. Code:
```//Try this
..
If the error persists, then check your function's parameter list, it should be "float function(float radius)"

6. i declared my radius with the other declarations as an int is this ok?

and if so would it be int radius (float radius) because where im confuse is where I declared the parameters why must there be a float radius next to it, whats the purpose of the float?

The program acepts a int from the user, so I called that int radius. The int/radius is what is needed to do the math for the program. This is what I have so far, and it keeps giving me that error.

Code:
```/* The purpose of this program is to read in the radius and print out
the circle's diameter, circumference, and area */

#include <stdio.h>
#include <conio.h>
#define PI 3.14159

int main()

/* This function asks the user to type in a number for the radius of a circle, and returns the values
of what that number would be in diameter, circumference and area form. */

{
scanf ("%d");
printf("The Diameter is %f", diameter);
printf("The circumference is %f", circum);
printf("The area is %f", area);
return 0;

getch();
}

/* This function lists the diameter of the number inputed as the radius of the circle */

float diameter()

{
}

/* This function lists the circumference of the number inputed as the radius of the circle */

float circum()

{
return (2 * PI * radius);

}

/* This function lists the area of the number inputed as the radius of the circle */

float area()

{

}```

7. >> and if so would it be int radius (float radius) because where im confuse is where I declared the parameters why must there be a float radius next to it, whats the purpose of the float?

You didn't define a radius() function in your code. I'm guessing all it does is grab the radius from the user. But since you did that in main already, I'm assuming you don't need that function.

>>scanf ("%d");
change it to scanf ("%f", &radius);

>> printf("The Diameter is %f", diameter);
You didn't call the function or pass in any parameters here.
Change to

>> float diameter(){

Make appropriate changes for the rest of your functions. You may want to specify the precision in your output but that's another topic that you can search for on this board.