In this C++ tutorial, you will learn how to find the inverse cosine of a value using acos() function of cmath, with syntax and examples.

## C++ acos()

C++ acos() returns inverse cosine of a number in radians.

## Syntax

The syntax of C++ acos() is

`acos(x)`

where

Returns

The return value depends on the type of value passed for parameter x. The return value of acos(x) is

• double if x is double.
• float if x is float.
• long double if x is long double.

The synopsis of acos() function is

```double acos(double x);
float acos(float x);
long double acos(long double x);
double acos(T x); // for integral type argument values```

acos() is a function of cmath library. Include cmath library in the program, if using acos().

## Example

In this example, we read x value from the user and find the inverse cosine of this value using acos() function.

C++ Program

```#include <iostream>
#include<cmath>
using namespace std;

int main() {
double x;
cout << "Enter a value : ";
cin >> x;

double result = acos(x);
cout << "acos(" << x << ") : " << result << " radians" << endl;
}```

Output

```Enter a value : 0.5
```Enter a value : 0