Advertisement

# C# - Trigonometry Angles in Radians using Math Class

Here, we are going to learn about the demonstrate the trigonometry angles in radians using Math class in C#. By Nidhi Last updated : April 15, 2023

## Trigonometry Angles in Radians

Here, we will get the values of trigonometry angles for the specified radians using Math class.

## C# program to demonstrate the trigonometry angles in radians using Math class

The source code to demonstrate the trigonometry angles in radians is given below. The given program is compiled and executed successfully on Microsoft Visual Studio.

```//C# program to demonstrate the trigonometry Angles
//in radians using Math class

using System;

class Demo
{
static void Main(string[] args)
{
double sinPi3;
double cosPi3;
double tanPi3;

sinPi3 = Math.Sin(Math.PI / 3);
cosPi3 = Math.Cos(Math.PI / 3);
tanPi3 = Math.Tan(Math.PI / 3);

Console.WriteLine("sin (pi/3)    = "+ sinPi3);
Console.WriteLine("cos (pi/3)    = "+ cosPi3);
Console.WriteLine("tan (pi/3)    = "+ tanPi3);
}
}
```

## Output

```sin (pi/3)    = 0.866025403784439
cos (pi/3)    = 0.5
tan (pi/3)    = 1.73205080756888
Press any key to continue . . .
```

## Explanation

Here, we created a Demo class that contains the Main() method. In the Main() method, we created three variables of double type.

```sinPi3 = Math.Sin(Math.PI / 3);
cosPi3 = Math.Cos(Math.PI / 3);
tanPi3 = Math.Tan(Math.PI / 3);
```

In the above code we calculated the trigonometry angles based radians using predefined method of Math class, and then print the result on the console screen.

Comments and Discussions!

Student's Section
Subscribe

Copyright © 2024 www.includehelp.com. All rights reserved.