Saturday, April 6, 2013

sin function in c

Sin function returns sine of an angle(in radian).
Declaration: double sin(double);

C programming code

#include <stdio.h>
#include <math.h>
 
int main()
{
  double result, x = M_PI/6;
 
  result = sin(x);
 
  printf("The sin(%lf) = %.2lf\n", x, result);
 
  return 0;
}
Compiler used: 
GCC
Output of program:

No comments:

Post a Comment