![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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
The MathF.Sin() method in C# is used to return the sine of a given float value argument.
Syntax
Following is the syntax −
public static float Sin (float val);
Above, Val is the angle whose sine is to be returned.
Example
Let us now see an example to implement the MathF.Sin() 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.Sign(val1) = -0.5440211 MathF.Sign(val2) = NaN
Example
Let us now see another example to implement the MathF.Sin() 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.Sin(val1) = "+MathF.Sin(val1)); Console.WriteLine("MathF.Sin(val2) = "+MathF.Sin(val2)); Console.WriteLine("MathF.Sin(val3) = "+MathF.Sin(val3)); } }
Output
This will produce the following output −
MathF.Sin(val1) = NaN MathF.Sin(val2) = NaN MathF.Sin(val3) = 0.3420202
Advertisements