acos() - Mathematical Function

How is Mathematical Function "acos()" used in C++?
How to find the arc cosine value of an argument using c++?


acos() is a Mathematical Function that returns the arc cosine value for the give argument. The argument value must be in the range -1 to 1, otherwise a domain error is triggered.

Syntax to find Arc Cosine Value:

float acos ( float arg );
double acos ( double arg );
long double acos ( long double arg );

Example :

#include <iostream.h>
#include <cmath.h>
int main()
double ar, res;
cout << "Enter an argument between -1 and 1\n";
cin >> ar;
res = acos(ar);
cout << "The arc cosine value is::" << res << endl;
return 0;

Result :

Enter an argument between -1 and 1
The arc cosine value is::1.36944

In the above example acos() is used to find the arc cosine value of ".2"

C++ Tutorial

Ask Questions

Ask Question