This blog is under construction

Monday 30 April 2012

tanh example in C

Header file:
    math.h

Synopsis:
     double tanh(double x);

Description:
     It returns the hyperbolic tangent of x.


tanh function C example:


  #include<stdio.h>
  #include<math.h>
  int main() {
        double x, result;
        printf("Enter your input:");
        scanf("%lf", &x);
        result = tanh(x * 3.14 / 180);
        printf("Hyperbolic tanh of %lf is %lf\n", x, result);
        return 0;
  }



  Output:
  jp@jp-VirtualBox:~/cpgms/math$ gcc tanh.c -lm
  jp@jp-VirtualBox:~/cpgms/math$ ./a.out
  Enter your input:45
  Hyperbolic tanh of 45.000000 is 0.655567



No comments:

Post a Comment