C library functions - sin ()
description
C library functiondouble sin (double x) Returns the sine of xradians.
statement
Here is the sin () function's declaration.
double sin(double x)
parameter
- x - floating-point value represents an angle in radians.
return value
This function returns the sine of x.
Examples
The following example demonstrates the sin () function is used.
#include <stdio.h> #include <math.h> #define PI 3.14159265 int main () { double x, ret, val; x = 45.0; val = PI / 180; ret = sin(x*val); printf("%lf 的正弦是 %lf 度", x, ret); return(0); }
Let's compile and run the above program, which will result in the following:
45.000000 的正弦是 0.707107 度