34 lines
769 B
C
34 lines
769 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() {
|
||
|
int degrees_start, degrees_end;
|
||
|
float radians, sin_val, cos_val, tan_val;
|
||
|
|
||
|
printf("Start: ");
|
||
|
scanf("%d", °rees_start);
|
||
|
printf("End: ");
|
||
|
scanf("%d", °rees_end);
|
||
|
printf("Degs\tRad\tsin\tcos\ttan\n");
|
||
|
|
||
|
for (int i = degrees_start; i <= degrees_end; i++) {
|
||
|
process((float)i, &radians, &sin_val, &cos_val, &tan_val);
|
||
|
printf("%d\t%0.3f\t%0.3f\t%0.3f\t%0.3f\n", i, radians, sin_val, cos_val, tan_val);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|