30 lines
647 B
C
30 lines
647 B
C
#include <stdio.h>
|
|
#include <math.h>
|
|
|
|
|
|
float degrees_to_radians(float degrees) {
|
|
return M_PI * degrees / 180.0;
|
|
}
|
|
|
|
void process(float degrees, float* radians, float* sin_val, float* cos_val, float* tan_val) {
|
|
*radians = degrees_to_radians(degrees);
|
|
*sin_val = sin(*radians);
|
|
*cos_val = cos(*radians);
|
|
*tan_val = tan(*radians);
|
|
}
|
|
|
|
|
|
int main() {
|
|
float degrees, radians, sin_val, cos_val, tan_val;
|
|
|
|
printf("Degrees: ");
|
|
scanf("%f", °rees);
|
|
|
|
process(degrees, &radians, &sin_val, &cos_val, &tan_val);
|
|
|
|
printf("Radians: %f\n", radians);
|
|
printf("Sine: %f\n", sin_val);
|
|
printf("Cosine: %f\n", cos_val);
|
|
printf("Tangent: %f\n", tan_val);
|
|
}
|