The acos()
functionarc cosine
function
Figure 1 shows the mathematical representation of the acos()
function and Figure 2 shows the visual representation of the acos()
function.
Note: The
math.h
header file is required for this function.
To convert radians
to degrees
, use the following formula.
degrees = radians * ( 180.0 / PI )
double acos(double num)
This function requires a number as a parameter. The parameter must be a double value between -1 and 1.
acos()
returns the inverse cosine
of a number (radian double value) that is sent as a parameter. The return value lies in interval [0, pi]
radians.
#include<stdio.h>//header file#include<math.h>int main() {//positive number in radiansprintf("The arc cosine of %lf is %lf radians \n", 0.5, acos(0.5));// negative number in radiansprintf("The arc cosine of %lf is %lf radians \n", -0.5, acos(-0.5));//applying acos() and then converting the result in radians to degrees// radians = 0.5// PI = 3.14159265double result=acos(0.5) * (180.0 / 3.14159265);printf("The arc cosine of %lf is %lf degrees \n", 0.5, result);}