 # C sin()

The sin() function defined in the math.h header file. It helps to return the sine value of given radian value.

``````
double sin(double x) #where x can be in int, float or long double
```
```

## sin() Parameters:

The sin() function takes a single parameter which is a value representing an angle expressed in radians.

Parameter Description Required / Optional
double value A double value indicates angle in radians Required

## sin() Return Value

The return value of sin() function is a number between 1 and -1.

Input Return Value
-1<x ≥ 1 a number greater than or equal to 0
x < -1 NaN (not a number)

## Examples of sin()

### Example 1: Working of sin() function in C?

``````
#include <stdio.h>
#include <math.h>
int main()
{
double v;
double output;

v = 2.3;
output = sin(v);
printf("sin(%.2lf) = %.2lf\n", v, output);

v = -2.3;
output = sin(v);
printf("sin(%.2lf) = %.2lf\n", v, output);

v = 0;
output = sin(v);
printf("sin(%.2lf) = %.2lf\n", v, output);

return 0;
}
```
```

Output:

```
sin(2.30) = 0.75
sin(-2.30) = -0.75
sin(0.00) = 0.00
```

### Example 2: How sin() function worked in C?

``````
#include <stdio.h>
#include <math.h>
#define PI 3.14159265

int main () {
double v, out, value;

v = 45.0;
value = PI / 180;
out = sin(v*value);
printf("The sine value of %lf is %lf degrees", v, out);

return(0);
}
```
```

Output:

```
The sine value of 45.000000 degrees is 0.707107
```
VIEW ALL
VIEW ALL
##### OtherTutorials
VIEW ALL 