C# Finding the Sine of an Angle

You can use the Sin() function of the Math class to find the sine value in C#.

This function takes radians as a parameter and returns you the sine value..

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

radian = angle * (pi number /180);

An example of how the function is used is given below.

namespace ConsoleApplicationTest
{
    class Program {

        static void Main(string[] args) {

            double a = 30;
            double radian = a * (Math.PI / 180);
            double sin = Math.Sin(radian);
                       
            Console.WriteLine(sin);
            
            Console.ReadLine();
        }
    }
}

To find the sine of angle 30, we first converted it to radians. Then we send it to the function as a parameter. The result returns us as "0.5".



You May Interest

C# Getting Last Character of String

C# Finding Cosine of an Angle

C# Finding Tangent of an Angle

C# Finding the Operating System Username

C# Finding the Path to the Windows Folder