Latest web development tutorials

C library functions - acos ()

C standard library - <math.h> C standard library - <math.h>

description

C Library Functionsdouble acos (double x) Returns the inverse cosine of xin radians.

statement

Here is () statement acos function.

double acos(double x)

parameter

  • x - between [-1, +1] range of floating-point values.

return value

This function returns expressed in radians x inverse cosine, in radians interval [0, pi].

Examples

The following example demonstrates acos () function is used.

#include <stdio.h>
#include <math.h>

#define PI 3.14159265

int main ()
{
   double x, ret, val;

   x = 0.9;
   val = 180.0 / PI;

   ret = acos(x) * val;
   printf("%lf 的反余弦是 %lf 度", x, ret);
   
   return(0);
}

Let's compile and run the above program, which will result in the following:

0.900000 的反余弦是 25.855040 度

C standard library - <math.h> C standard library - <math.h>