tan - C math.h

C examples for math.h:tan

Type

function

From

<cmath>
<ctgmath>
<math.h>

Description

Returns the tangent of an angle of x radians.

Prototype


long double tanl (long double x);
long double tan (long double x);
     double tan (double x);
      float tanf (float x);
      float tan (float x);
     double tan (T x);           

Parameters

Parameter Description
x Value representing an angle, expressed in radians.

Return Value

Tangent of x radians.

Demo Code


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

#define PI 3.14159265//from   w  ww.j a  va2s.  c om

int main ()
{  
  double param = 45.0;
  double result = tan ( param * PI / 180.0 );
  printf ("The tangent of %f degrees is %f.\n", param, result );
  return 0;
}

Related Tutorials