Popular Tutorials
Start Learning CCertification Courses
Created with over a decade of experience and thousands of feedback.
Python online compiler
JavaScript online compiler
SQL online compiler
Java online compiler
HTML online compiler
C online compiler
C++ online compiler
C# online compiler
PHP online compiler
Swift online compiler
Kotlin online compiler
TypeScript online compiler
Go online compiler
Rust online compiler
Scala online compiler
Dart online compiler
R online compiler
Ruby online compiler
C cosh()
The cosh() function computes the hyperbolic cosine of a number.
cosh() Function Prototype
double cosh(double x)
The cosh() function takes a single argument (angle in radians) and returns the hyperbolic cosine of that angle as type double.
The cosh() function is defined in math.h header file.
In order to find the cosh() of long double or float numbers, you can use the following prototype.
long double coshl( long double arg); float coshf( float arg);
Example: C cosh()
#include <stdio.h>
#include <math.h>
int main ()
{
double x, result;
x = 0.5;
result = cosh(x);
printf("Hyperbolic cosine of %lf (in radians) = %lf\n", x, result);
x = -0.5;
result = cosh(x);
printf("Hyperbolic cosine of %lf (in radians) = %lf\n", x, result);
x = 0;
result = cosh(x);
printf("Hyperbolic cosine of %lf (in radians) = %lf\n", x, result);
x = 1.5;
result = cosh(x);
printf("Hyperbolic cosine of %lf (in radians) = %lf\n", x, result);
return 0;
}
Output
Hyperbolic cosine of 0.500000 (in radians) = 1.127626 Hyperbolic cosine of -0.500000 (in radians) = 1.127626 Hyperbolic cosine of 0.000000 (in radians) = 1.000000 Hyperbolic cosine of 1.500000 (in radians) = 2.352410
Did you find this article helpful?