C Programming Tutorial
C Programming allows us to perform mathematical operations through the functions defined in
C Math Functions
In the C Programming Language, the sin function returns the sine of x.
Syntax
The syntax for the sin function in the C Language is:
double sin(double x);
Parameters or Arguments
A value expressed in radians (not degrees).
Returns
The sin function returns the sine of x, measured in radians.
Required Header
In the C Language, the required header for the sin function is:
#include <math.h>
Applies To
In the C Language, the sin function can be used in the following versions:
- ANSI/ISO 9899-1990
sin Example
/* Example using sin by c programming */ #include <stdio.h> #include <math.h> int main(int argc, const char * argv[]) { /* Define temporary variables */ double value; double result; /* Assign the value we will find the sin of */ value = 0.5; /* Calculate the Sine of value */ result = sin(value); /* Display the result of the calculation */ printf("The Sine of %f is %f\n", value, result); return 0; }
When compiled and run, this application will output:
The Sine of 0.500000 is 0.479426