
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
Math.Sin() Method in C#
The Math.Sin() method in C# is used to return the sine of a specified angle.
Syntax
Following is the syntax −
public static double Sin (double val);
Above, the argument value is an angle.
Example
Let us now see an example to implement Math.Sin() method −
using System; public class Demo { public static void Main(){ double val1 = 30.0; Console.WriteLine(Math.Sin( (val1 * (Math.PI)) / 180 )); } }
Output
This will produce the following output −
0.5
Example
Let us see another example to implement Math.Sin() method −
using System; public class Demo { public static void Main(){ double val1 = 45.0; double val2 = Double.PositiveInfinity; double val3 = Double.NaN; Console.WriteLine(Math.Sin( (val1 * (Math.PI)) / 180 )); Console.WriteLine(Math.Sin(val2)); Console.WriteLine(Math.Sin(val3)); } }
Output
This will produce the following output −
0.707106781186547 NaN NaN
Advertisements