You are here

sin function in c

Sin function returns sine of an angle(in radian).

Declaration: double sin(double);

C programming code

  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6.   double result, x = M_PI/6;
  7.  
  8.   result = sin(x);
  9.  
  10.   printf("The sin(%lf) = %.2lf\n", x, result);
  11.  
  12.   return 0;
  13. }