0

Hi, I am very new to C, and also to this forum, so please bear with me. :!: :o I am trying to create a console astronomical program, and I need to know how to convert radian numbers to degrees. I would appreciate any help.

3
Contributors
2
Replies
3
Views
13 Years
Discussion Span
Last Post by Dave Sinkula
0

Greetings ray96,

Mathematics in C is not difficult to use. For example, lets take this word problem for example:

Note: Since 360° = 2 radians, then 180° = radians.
We will use this fact to convert between degrees and radians.

» Convert 5/12 radians to degrees.
Lets take a simple approach:

Step 1: 5 rads / 12
Step 2: 180 degs / rads

Step 3: 5 x 180degs / 12
Step 4: 75 degrees

Doing this in C wont be hard at all:

int radToDegrees(int radians) {
	float s1;

	s1 = (radians * 180.0f) / 12.0f;

	return (int)s1;
}

This algorithm may not be perfect, but its a good start. If you have any further questions please feel free to ask.

- Stack Overflow

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.