Site icon Codeforcoding

cosh arithmetic function in C language with example

cosh arithmetic function in C language with example

In this tutorial, we will describe about cosh arithmetic function in C language with example.

Description of cosh()

cosh – arithmetic function in C language returns hyperbolic cosine value

 

cosh() : In the C Programming language, the coshh() function is used to calculate hyperbolic cosine value of given arguments.

Declaration of cosh() function

Syntax

The syntax for the cosh function in C programming Language is

double cosh(double x);

Parameter or Arguments list

x is the parameter of this function

 

Returns

The cosh function returns hyperbolic cos value of x, measured in radians.

 

Required header

The required header file for the cosh function in the C programming  language is

#include <math.h>

Example

Program 1

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

int main()
{
    double x=0.5,y=1;

    printf("Hyperbolic cosine value of %f is %f\n",x,cosh(x));
        printf("Hyperbolic cosine value of %f is %f\n",y,cosh(y));
getch();
    return 0;
}

 

When above program is compiled and run, it will produce the following result

hyperbolic Cosine value of 0.500000 is: 1.127626
hyperbolic Cosine value of 1.000000 is: 1.543081

 

program 2

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

int main()
{   //define the variable
    double coshValue;
    double inputValue;
    //get input from user
    printf("Please enter the value to calculate cosh value :");
    scanf("%lf",&inputValue);
    //calculate the hyperbolic cosine value
    coshValue=cosh(inputValue);
    //display the hyperbolic cosine value
     printf("\nHyperbolic cosine value of %lf is %lf\n",inputValue,coshValue);
    getch();
    return 0;
}

When above program is compiled and run, it will produce the following result

Please enter the value to calculate cosh value :0.5
Hyperbolic cosine value of 0.500000 is 1,127626

Similar functions

Other C programming language functions that are  similar to the cosine function

 

Other C programming language functions that are  similar to the cosine function      

cosh function   in C  language                               

sinh function in C language

tanh function in C language

abs function in C language

floor function in C language

ceil function in C language

round function in C language

 

suggested for you

Function in C language

User defined function in C language

Arithmetic functions in C Language

String function in C language

 

sinh arithmetic function in C language with example
exp function in C programming language
Exit mobile version