Popular Tutorials
Start Learning CCertification Courses
Created with over a decade of experience and thousands of feedback.
Python online compiler
JavaScript online compiler
SQL online compiler
Java online compiler
HTML online compiler
C online compiler
C++ online compiler
C# online compiler
PHP online compiler
Swift online compiler
Kotlin online compiler
TypeScript online compiler
Go online compiler
Rust online compiler
Scala online compiler
Dart online compiler
R online compiler
Ruby online compiler
C sin()
The sin() function returns the sine of a number.
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?