tan function(Tangent) in C Language – example and detail

In the C Programming Language, the tan characteristic returns the tangent of x.


The syntax for the tan characteristic in the C Language is:

double tan(double x);

Parameters or Arguments


A value expressed in radians (not degrees).


The tan characteristic returns the tangent of x, measured in radians.

Required Header

In the C Language, the required header for the tan feature is:

#include <math.h>

Applies To

In the C Language, the tan function can be used in the following versions:

ANSI/ISO 9899-1990

tan Example

/* Example using tan by TechOnTheNet.com */

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

int main(int argc, const char * argv[])
    /* Define temporary variables */
    double value;
    double result;

    /* Assign the value we will find the tan of */
    value = 0.5;

    /* Calculate the Tangent of value */
    result = tan(value);

    /* Display the result of the calculation */
    printf("The Tangent of %f is %f\n", value, result);

    return 0;

When compiled and run, this application will output:

The Tangent of 0.500000 is 0.546302

Similar Functions

Other C functions that are comparable to the tan function:

acos function asin feature atan feature atan2 feature cos function sin characteristic