C examples for math.h:cos
function
<cmath> <ctgmath> <math.h>
Returns the cosine of an angle of x radians.
long double cosl (long double x); long double cos (long double x); double cos (double x); float cosf (float x); float cos (float x); double cos (T x);
Parameter | Description |
---|---|
x | Value representing an angle expressed in radians. |
Cosine of x radians.
#include <stdio.h> #include <math.h> /* cos */ #define PI 3.14159265//from ww w . j a v a2s . c o m int main () { double param = 60.0; double result = cos ( param * PI / 180.0 ); printf ("The cosine of %f degrees is %f.\n", param, result ); return 0; }