C# - Math Tan() Method
The C# Math Tan() method is used to return trigonometric tangent of an angle (angle should be in radians). In special cases it returns the following:
- If the argument is NaN, NegativeInfinity or PositiveInfinity, the method returns NaN.
Syntax
public static double Tan (double arg);
Parameters
arg |
Specify the angle in radian. |
Return Value
Returns the trigonometric tangent of an angle.
Example:
In the below example, Tan() method is used to find out the trigonometric tangent of an angle.
using System; class MyProgram { static void Main(string[] args) { double pi = Math.PI; Console.WriteLine(Math.Tan(pi/6)); Console.WriteLine(Math.Tan(pi/4)); Console.WriteLine(Math.Tan(pi/3)); } }
The output of the above code will be:
0.577350269189626 1 1.73205080756888
❮ C# Math Methods