#include <stdio.h>
#include <math.h>
double to_rad(double deg) {
double rad = 0.0;
// prima riduco all'intervallo [0...360)
deg = fmod(deg, 360.0);
// poi applico il fattore di conversione
rad = deg * M_PI / 180;
return rad;
}
int main() {
int deg;
for(deg = 0; deg <= 360; deg += 30) {
printf("%-3d --> %lf\n", deg, to_rad(deg));
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: