37 lines
608 B
C
37 lines
608 B
C
|
#include <stdio.h>
|
||
|
#include <math.h>
|
||
|
|
||
|
|
||
|
float degrees_to_radians(float degrees) {
|
||
|
return M_PI * degrees / 180.0;
|
||
|
}
|
||
|
|
||
|
|
||
|
int main() {
|
||
|
int rc, start, end;
|
||
|
|
||
|
printf("Start: ");
|
||
|
rc = scanf("%d", &start);
|
||
|
if (rc != 1) {
|
||
|
printf("Please enter a real integer\n");
|
||
|
return 1;
|
||
|
}
|
||
|
printf("End: ");
|
||
|
rc = scanf("%d", &end);
|
||
|
if (rc != 1) {
|
||
|
printf("Please enter a real integer\n");
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
if (start > end) {
|
||
|
printf("Please ensure that start value is smaller than end value\n");
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
for (int i = start; i <= end; i++) {
|
||
|
printf("%d %f\n", i, degrees_to_radians((float)i));
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|