

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
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
<p>The MathF.Tan() method in C# is used to return the tangent of a given float value argument.</p><h2>Syntax</h2><p>Following is the syntax −</p><pre class="result notranslate">public static float Tan (float val);</pre><p>Above, Val is the angle whose tangent is to be returned.</p><h2>Example</h2><p>Let us now see an example to implement the MathF.Tan() method −</p><!--<p><a href="" target="_blank" rel="nofollow" class="demo"><i class="fa-external-link"></i> Live Demo</a></p>--><pre class="prettyprint notranslate">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)); } }</pre><h2>Output</h2><p>This will produce the following output −</p><pre class="result notranslate">MathF.Tan(val1) = 0.6483608 MathF.Tan(val2) = NaN</pre><h2>Example</h2><p>Let us now see another example to implement the MathF.Tan() method −</p><!--<p><a href="" target="_blank" rel="nofollow" class="demo"><i class="fa-external-link"></i> Live Demo</a></p>--><pre class="prettyprint notranslate">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)); } }</pre><h2>Output</h2><p>This will produce the following output −</p><pre class="result notranslate">MathF.Tan(val1) = NaN MathF.Tan(val2) = NaN MathF.Tan(val3) = 0.3639702</pre>
- Related Questions & Answers
- PHP tan() Function
- tan() function in PHP
- C# Object.GetType() Method with Examples
- C# Queue.TrimExcess() Method with Examples
- C# Stack.TrimExcess() Method with Examples
- C# Object.GetHashCode() Method with Examples
- Java toDegrees() method with Examples
- jQuery not() method with Examples
- JavaScript removeEventListener() method with examples
- Java signum() method with Examples
- Java lang.Long.toBinaryString() method with Examples
- Java cbrt() method with Examples
- Java ceil() method with Examples
- Java sqrt() method with Examples
- Java floor() method with Examples
- MathF.Abs() Method in C# with Examples
Advertisements