Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding .Tan() Example - C# Math Function #5583

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions content/c-sharp/concepts/math-functions/terms/tan/tan.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,35 @@ The `Math.Tan()` method takes only one parameter, `angle`, an angle in radians o
- `NegativeInfinity`
- `PositiveInfinity`

## Example

The following example first converts `30` degrees to radians, then uses the `Math.Tan()` method to return the tangent of that angle. Finally, the `Console.WriteLine()` function prints the result to the console:
```cs
using System;

public class Example {
public static void Main(string[] args) {
// Define an angle in degrees
double degrees = 30;

// Convert the angle to radians
double radians = degrees * Math.PI/180;

// Calculate the tangent of the angle
double tangent = Math.Tan(radians);

// Display result
Console.WriteLine("The tangent of " + degrees + " degrees is: " + tangent);
}
}
```

The example will result in the following output:

```shell
The tangent of 30 degrees is: 0.577350269189626
```

## Codebyte Example

The following example is runnable and returns the tangent of the `angle` given in degrees:
Expand Down
Loading