C# Finding Tangent of an Angle

You can use the Tan() function of the Math class to find the tangent value in trigonometry in the C# programming language.

This function takes radian as a parameter and returns you the tangent value.

If you have an angle, you should convert it to radians like this..

radians = angle * (pi number /180);

Let's examine the code below..

namespace ConsoleApplicationTest
{
    class Program {

        static void Main(string[] args) {

            double a = 60;
            double radian = a * (Math.PI / 180);
            double tangent = Math.Tan(radian);
                       
            Console.WriteLine(tangent);
            
            Console.ReadLine();

        }
    }
}

To find the tangent of 60 angle, we first convert angle to radians. Then we send it to the function as a parameter. The result is returned to us as "1.7321..".



You May Interest

C# Getting Today's Date

C# Finding Cosine of an Angle

C# Reverse Array

C# Getting Last Character of String

How to Find the Name of the Operating System in C# ?