 
 Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
MathF.Tan() Method in C# with Examples
The MathF.Tan() method in C# is used to return the tangent of a given float value argument.
Syntax
Following is the syntax −
public static float Tan (float val);
Above, Val is the angle whose tangent is to be returned.
Example
Let us now see an example to implement the MathF.Tan() method −
using System;
public class Demo {
   public static void Main(){
      float val1 = 10f;
      float val2 = float.NaN;
      Console.WriteLine("MathF.Tan(val1) = "+MathF.Tan(val1));
      Console.WriteLine("MathF.Tan(val2) = "+MathF.Tan(val2));
   }
}
Output
This will produce the following output −
MathF.Tan(val1) = 0.6483608 MathF.Tan(val2) = NaN
Example
Let us now see another example to implement the MathF.Tan() method −
using System;
public class Demo {
   public static void Main(){
      float val1 = float.PositiveInfinity;
      float val2 = float.NegativeInfinity;
      float val3 = (20f * (MathF.PI)) / 180;
      Console.WriteLine("MathF.Tan(val1) = "+MathF.Tan(val1));
      Console.WriteLine("MathF.Tan(val2) = "+MathF.Tan(val2));
      Console.WriteLine("MathF.Tan(val3) = "+MathF.Tan(val3));
   }
}
Output
This will produce the following output −
MathF.Tan(val1) = NaN MathF.Tan(val2) = NaN MathF.Tan(val3) = 0.3639702
Advertisements
                    