What is Math.sin() in C#?
C# has a built-in Math class that provides useful mathematical functions and operations. The class has the Sin() function, which is used to compute the sine of a specified angle.
Syntax
public static double Sin (double value);
Parameters
value:valueis of theDoubletype and represents the input angle, which is determined by findingSin(). Its range is all real numbers.valueis measured in radians.
Return value
Double:Sin()returns the sine of a number and its type isDouble. It is true only for all real numbers invalue.NaN:Sin()returnsNaNtype for invalidvalue, i.e., NaN, infinity, or negative infinity.
Degrees can be converted into radians by multiplying degrees by Math.PI/180.
Example
using System;class Educative{static void Main(){double result = Math.Sin(0);System.Console.WriteLine("Sin(0) = "+ result);double result1 = Math.Sin(1);System.Console.WriteLine("Sin(1) = "+ result1);double result2 = Math.Sin(-1);System.Console.WriteLine("Sin(-1) = "+ result2);double result3 = Math.Sin(Double.PositiveInfinity);System.Console.WriteLine("Sin(∞) = "+ result3);double result4 = Math.Sin(400);System.Console.WriteLine("Sin(400) = "+ result4);}}