Home >>C Math Functions >C math sin() function

C math sin() function

C math sin() function

The C math sinh() function is used to return the sine of a radian angle x. This function is defined in math.h header file. It's return value lies between 1 and -1

Syntax:

double sin(double x)

Parameters:

x − It is the floating point value representing an angle expressed in radians.

Here is an example of sin() function:


#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("The sine of %lf is %lf degrees", x, ret);
return(0);
}

Output:
The sine of 45.000000 is 0.707107 degrees

Example-2


#include <stdio.h>
#include <math.h>
#define PI 3.14159265
int main () {
double x, ret, val;
x = 60.0;
val = PI / 180;
ret = sin(x*val);
printf("The sine of %lf is %lf degrees", x, ret);
return(0);
}

Output:
The sine of 60.000000 is 0.866025 degrees

No Sidebar ads