My codes need to use cos, sin function, but while I was coding it, it occurred to me that the cos and sin functions weren't returning the right values. I then wrote a small testing codes as such:
The value printed is 0... and when I put 3.14 as x, the value went to millions.Code:#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main (int argc, char ** argv)
{
double v, x;
x = 0;
v = cos(x);
printf ("%d\n", v);
return 0;
}
What seems to be the problem?