118
C++ Math tan()
The function finds the tangent of an angle specified in terms of radian.
Syntax
Consider a radian ‘x’. Syntax would be:
Note: If the value passed is an integral type, then it is cast to double.
Parameter
x: The value given in radian.
Return value
It returns the tangent of an angle given in radian.
Example 1
Let’s see the simple example when the value of x is positive.
Output:
Tangent of an angle is : 0.176236
In this example, tan() function calculates the tangent of an angle when the value of degree is equal to 10.
Example 2
Let’s see the simple example when the value of degree is negative.
Output:
Tangent of an angle is :-1.72993
In this example, tan() function calculates the tangent of an angle when the value of degree is negative i.e -60.
Next TopicC++ Math Functions