function in C

tanh function in C Programming language

tanh function in  C programming language

In this tutorial, we will discuss about tanh function in C Programming language

Description

Description of tanh() in  C programming language

The tanh() function in C programming  language (C library) returns the hyperbolic tangent value of the radian angle x

tanh() : In the C Programming language, this  is used to calculate a hyperbolic tangent value of given arguments.

Declaration of tanh()

The declaration of the tanh()  in the C programming language

double tanh(double x);

Parameter or Arguments list

parameter of tanh() function is:

x- this is a floating point value assigned to angle as the parameter of this function and always measured in radians

Returns

This returns hyperbolic tangent value of x, measured in radians.

Required header

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

#include <math.h>

tanh function in C

Example

The following example shows the usage if tanh() function

Program 1

#include <stdio.h>
#include <stdlib.h>

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

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

 

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

Hyperbolic Tangent value of 0.500000 is: 0.462117
Hyperbolic Cosine value of 1.000000 is: 0.761594

 

Program 2

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

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

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

Please enter the value to calculate tanh value :0.5
Hyperbolic tangent value of 0.500000 is 0.462117

 

 

Similar Functions

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

cosh function   in C  language                               

sinh function in C language

abs function in C language

floor function in C language

ceil function in C language

round function in C language

sqrt function in C language

pow function in C language

exp function in C language

log function in C language

log10 function in C language

trunc 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

          

 

 

tan function in C programming language
sinh arithmetic function in C language with example
Karmehavannan

I am Mr S.Karmehavannan. Founder and CEO of this website. This website specially designed for the programming learners and very especially programming beginners, this website will gradually lead the learners to develop their programming skill.

Recent Posts

C# inverted full pyramid star pattern

C# inverted full pyramid star pattern In this article, we will discuss the concept of…

3 weeks ago

C# Full Pyramid star pattern program

C# Full Pyramid star pattern program In this article, we will discuss the concept of…

1 month ago

Program to count vowels,consonants,words, characters and space in Java

Program to count vowels, consonants, words, characters and space in Java In this article, we…

1 month ago

How to print multiplication table using Array in C++ language

How to print multiplication table using Array in C++ language In this post, we will…

1 month ago

C Program to multiplication table using Array

C Program to multiplication table using Array In this tutorial , we will discuss about…

2 months ago

Java program to check odd or even using recursion

Java program to check odd or even using recursion In this tutorial, we discuss a…

2 months ago