Current location - Training Enrollment Network - Mathematics courses - What library function is used to realize C language sin(x)?
What library function is used to realize C language sin(x)?
Use the following methods:

First, you need to include

Then, you can use the sin () function to calculate the sine value of x, and its syntax is as follows:

Double crime (double X); // x is a radian value, not an angle.

Finally, you can use the printf () function to output the value of sin(x), for example:

Please click to enter a picture description.

Including & ltstdio.h & gt

# include & ltmath.h & gt

int main()

{

Double x = 3.14; //define a radian value

double y = sin(x); //Call the sin () function to calculate the sine value of x.

printf("sin(%lf) = %lf\n ",x,y); //output results

Returns 0;

}