C cosh() library function

The function double cosh(double x); returns the hyperbolic cosine of x radians.

Function prototype of cosh

double cosh(double x);
  • x : A floating point value representing an angle in radians.

Return value of cosh

It returns the hyperbolic cosine of x.

C program using cosh function

The following program shows the use of cosh function to calculate hyperbolic cosine of a number.

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

int main(){
    double value, radian;
    printf("Enter a number\n");
    scanf("%lf", &radian);
    
    value = cosh(radian);
    printf("The hyperbolic cosine of %lf is %0.4lf\n", radian, value);
        
    return 0;
}

Output
Enter a number
2.5
The hyperbolic cosine of 2.500000 is 6.1323
Enter a number
1.0
The hyperbolic cosine of 2.500000 is 1.5431