The C cosh function is a Math Function used to calculate the Trigonometric Hyperbolic Cosine of a given value or specified expression. The syntax of the cosh function is
double cosh(double number);
C cosh Function Example
The C math cosh Function allows you to find the Hyperbolic Cosine of a given value. In this program, we will find the Hyperbolic Cosine of different data type values and display the output.
#include <stdio.h> #include <math.h> int main() { printf("\n The Hyperbolic Cosine Value of 0 = %.4f ", cosh(0)); printf("\n The Hyperbolic Cosine Value of 1 = %.4f ", cosh(1)); printf("\n The Hyperbolic Cosine Value of 10.25 = %.4f ", cosh(10.25)); printf("\n The Hyperbolic Cosine Value of 2.59 = %.4f ", cosh(2.59)); printf("\n The Hyperbolic Cosine Value of -7.23 = %.4f ", cosh(-7.23)); printf("\n The Hyperbolic Cosine Value of -4.32 = %.4f ", cosh(-4.32)); return 0; }
cosh Example 2
In this C Programming example, we are allowing the user to enter their value. Next, this program uses the cosh function to find the hyperbolic cosine of a user given number.
#include <stdio.h> #include <math.h> int main() { float number, coshValue; printf(" Please Enter any Numeric Value : "); scanf("%f", &number); coshValue = cosh(number); printf("\n The Hyperbolic Cosine Value of %.2f = %.4f ", number, coshValue); return 0; }
Please Enter any Numeric Value : 9.34
The Hyperbolic Cosine Value of 9.34 = 5692.2051