w3resource

C sin() function

C sin() function - Calculate Sine

Syntax:

double sin(double x)

The sin() function is used to calculate the sine of x, with x expressed in radians.

Parameters:

Name Description Required /Optional
x Angle in radians. Required

Return value from sin()

  • This function returns sine of x.

Example: sin() function

The following example shows the usage of sin() function.

#include <math.h>
#include <stdio.h>
 
int main(void)
{
   double x, y; 
   x = 1;
   y = sin(x);   
   printf("sin( %lf ) = %lf\n", x, y);
   x = 0;
   y = sin(x);
   printf("\nsin( %lf ) = %lf\n", x, y);
}

Output:

sin( 1.000000 ) = 0.841471

sin( 0.000000 ) = 0.000000

C Programming Code Editor:

Previous C Programming: C cosh()
Next C Programming: C sinh()



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/c-programming/math/c-sin.php