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.

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

#include <math.h>
 double degrees_to_radians(double degrees)
    double PI = 4.0 * atan(1.0);
    return degrees * PI / 180.0;