Tutorial Gateway

  • C
  • C#
  • Java
  • Python
  • SQL
  • MySQL
  • Js
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Python Programs
    • Java Programs

C tanh Function

by suresh

The C tanh function is a Math Function used to calculate the Trigonometric Hyperbolic Tangent of a given value or specified expression. The syntax of the tanh in C Programming is

double tanh(double number);

C tanh Function Example

The math tanh Function allows you to find the Hyperbolic Tangent of a given value.

In this program, We are going to find the Hyperbolic Tangent of different values, and display the output.

/* Example for TANH in C Programming */

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

int main()
{ 
    printf("\n The Hyperbolic Tangent Value of 0      = %.4f ", tanh(0));
    printf("\n The Hyperbolic Tangent Value of 1      = %.4f ", tanh(1));
    
    printf("\n The Hyperbolic Tangent Value of 1.25   = %.4f ", tanh(1.25));
    printf("\n The Hyperbolic Tangent Value of 2.59   = %.4f ", tanh(2.59));
    
    printf("\n The Hyperbolic Tangent Value of -0.23  = %.4f ", tanh(-0.23));
    printf("\n The Hyperbolic Tangent Value of -4.32  = %.4f ", tanh(-4.32));
    
    return 0;
}

OUTPUT

c tanh Function 1

C tanh Example 2

In this C Programming example, we are allowing the user to enter their value. Next, we used the tanh function to find the hyperbolic tangent of a user given number.

/* Example for TANH in C Programming */

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

int main()
{
    float number, tanhValue;

    printf(" Please Enter any Numeric Value :  ");
    scanf("%f", &number);
  
    tanhValue = tanh(number);
  
    printf("\n Hyperbolic Tangent Value of %.2f = %.4f ", number, tanhValue);
  
    return 0;
}

OUTPUT

c tanh Function 2

Placed Under: C Programming

  • C Comments
  • C Escape Sequence
  • C Programming Operators
  • C Arithmetic Operators
  • C Assignment Operators
  • C Bitwise Operators
  • C Conditional Operator
  • C Increment & Decrement Optr
  • C Logical Operators
  • C Relational Operators
  • C Sizeof Operator
  • C If Statement
  • C IF ELSE Statement
  • C Else If Statement
  • C Nested If
  • C Break Statement
  • C Continue Statement
  • C Goto Statement
  • C Switch Case
  • C For Loop
  • C While Loop
  • C Do While Loop
  • C Arrays
  • C Two Dimensional Array
  • C Multi Dimensional Array
  • C String
  • C Structures
  • C Nested Structures
  • C Array of Structures
  • C Structures and Functions
  • C Union
  • C Structure & Union differences
  • C Pointers
  • C Pass Pointers to Functions
  • C GETS
  • C fgets Function
  • C fgetc
  • C fputs function
  • C fputc
  • C Functions
  • C Types of Functions
  • C Pass Array to Functions
  • Call By Value & Call By Reference
  • C Recursion
  • C Program Examples
  • C Tutorial
  • C# Tutorial
  • Java Tutorial
  • JavaScript Tutorial
  • Python Tutorial
  • MySQL Tutorial
  • SQL Server Tutorial
  • R Tutorial
  • Power BI Tutorial
  • Tableau Tutorial
  • SSIS Tutorial
  • SSRS Tutorial
  • Informatica Tutorial
  • Talend Tutorial
  • C Programs
  • C++ Programs
  • Java Programs
  • Python Programs
  • MDX Tutorial
  • SSAS Tutorial
  • QlikView Tutorial

Copyright © 2021 | Tutorial Gateway· All Rights Reserved by Suresh

Home | About Us | Contact Us | Privacy Policy