You are here

cos in C - math.h

Cos function returns cosine of an angle(in radian).
1 radian = 57.2958(approximately).

Declaration: double cos(double);

C programming code

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