# acos in c

## What is acos in c programming?

acos in c is a mathematical function which is used to find arc cosine of a given number in radians.

This function is defined in math.h header file.

### Prototype

``````#include<math.h>
double acos(double y);``````

### Parameter

acos function takes floating point value as angle in radians.

### Return value

This function returns arc cosine of a given number.

## Example program for acos in c

``````#include <stdio.h>
#include <math.h>
#define PI 3.14
int main()
{
double x, res, val1;
x=35.0;
val1=PI/180;
res=acos(x*val1);
printf("The arc cosine of %lf is %lf degrees", x, res);
return 0;
}``````

``gcc file_name.c -lm``

### Code explanation

The variable val1 is defined in terms of degrees and passed to the acos function along with the input value. The result is printed onto the console.

acos() Man page

## Difference between acos and cos in c

acos in c is a mathematical function that is used to find the arc cosine of a given number in radians. cos in c is a mathematical function that is used to find the cosine of a given number.

Prototypes are as follows

``````double acos(double y);

double cos(double y);``````

## Difference between acos and cosh in c

acos in c is a mathematical function that is used to find the arc cosine of a given number in radians. cosh in c is used to find the hyperbolic cosine of a given number.

Prototypes are as follows

``````double acos(double y);

double cosh(double y);``````