Working on a simple school problem using C to calculate sine of 1 radian.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(int argc, const char * argv[])
{
double radian = (180 / M_PI);
double y = sin(radian);
printf("The sine of 1 radian is %.3f", y);
return 0;
}
The sine of a radian is 0.841, but I'm getting 0.680. Is this because of how I am calculating 1 radian, instead of just using radians
?
180 / pi
is one radian IN DEGREES.
But the sin()
function takes a value in radian.
So it's just sin(1)
.