Math formula

I'm not sure this is in the correct forum , but if not, could an admin/mod please move it. Thanks.

Ok, so I'm going to code information of a circle, given that the user enters one of the following:
Circumference;
Diameter;
Radius;
Area;

I've read through a lot of math formula and have come up with the ( I think ) correct formula to get the correct results.

Could someone please take a look and see whether or not they are correct.
Circle information:
	C - Circumference
	D - Diameter
	R - Radius
	A - Area
	pi = 3.14159

	
Entering Circumference
	Circumference = //userInput\\
	Diameter = circumference / pi
	Radius = ( circumference / pi ) / 2
	Area = pi * ( Radius * Radius )
	

Entering Diameter
	Circumference = pi * Diameter
	Diameter = //userInput\\
	Radius = Diameter / 2
	Area = ( ( Diameter * Diameter ) * pi ) / 4

	
Entering Radius
	Circumference = ( 2 * pi ) * Radius
	Diameter = Radius * 2
	Radius = //userInput\\
	Area = pi * ( Radius * Radius )

	
Entering Area
	Circumference = sqrt( 4 * ( pi * Area ) )
	Diameter =  sqrt( ( 4 *  Area ) / pi  )
	Radius = sqrt( Area / pi )
	Area = //userInput\\


Thanks for any help given!
That's right, so you're making some things unnecessarily complicated. For example, when you enter the area you could first calculate the radius and calculate the rest with the radius instead of using those area formulas. If you did that you'd just have to write a function for each input type that calculates the radius, and for the rest each one function that calculates the value using the radius.
Thanks for the reply.

I'm going to code a function for each entry ( 4 ), because on each entry, the userInput for each function will be able to calculate the remaining 3 bit's of info.

I'm just not too sure on whether the math was correct. Each site I looked at to learn about this had all the math formula without spaces. And I'm a bit too old to remember stuff like that from school, ahaha!
Topic archived. No new replies allowed.