C sin()

Function Prototype of sin()

double sin(double x)

The sin() function returns the sine of an argument (angle in radians).

[Mathematics] sinx = sin(x) [In C Programming]

It is defined in math.h header file.


The return value of sin() lies between 1 and -1.


Example: C sin() function

#include <stdio.h>
#include <math.h>

int main()
{
    double x;
    double result;

    x = 2.3;
    result = sin(x);
    printf("sin(%.2lf) = %.2lf\n", x, result);

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

    x = 0;
    result = sin(x);
    printf("sin(%.2lf) = %.2lf\n", x, result);


    return 0;
}

Output

sin(2.30) = 0.75
sin(-2.30) = -0.75
sin(0.00) = 0.00
Did you find this article helpful?