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# Finding the Computer Name

Splitting a String By Desired Character in C#

C# How To Find The Average Of 10 Numbers Using A While Loop

C# Getting Last Character of String

C# Getting Current Time