

- 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.Sin() Method in C# with Examples
<p>The MathF.Sin() method in C# is used to return the sine of a given float value argument.</p><h2>Syntax</h2><p>Following is the syntax −</p><pre class="result notranslate">public static float Sin (float val);</pre><p>Above, Val is the angle whose sine is to be returned.</p><h2>Example</h2><p>Let us now see an example to implement the MathF.Sin() 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.Sign(val1) = -0.5440211 MathF.Sign(val2) = NaN</pre><h2>Example</h2><p>Let us now see another example to implement the MathF.Sin() 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.Sin(val1) = "+MathF.Sin(val1)); Console.WriteLine("MathF.Sin(val2) = "+MathF.Sin(val2)); Console.WriteLine("MathF.Sin(val3) = "+MathF.Sin(val3)); } }</pre><h2>Output</h2><p>This will produce the following output −</p><pre class="result notranslate">MathF.Sin(val1) = NaN MathF.Sin(val2) = NaN MathF.Sin(val3) = 0.3420202</pre>
- Related Questions & Answers
- 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
- MathF.Acos() Method in C# with Examples
- MathF.Atan2() Method in C# with Examples
Advertisements