C# | Math.Cos() Method Last Updated : 11 Jan, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report Math.Cos() is an inbuilt Math class method which returns the cosine of a given double value argument(specified angle).Syntax: public static double Cos(double num) Parameter: num: It is the angle(measured in radian) whose cosine is to be returned and the type of this parameter is System.Double. Return Value: Returns the cosine of num of type System.Double. If num is equal to NegativeInfinity, PositiveInfinity, or NaN, then this method returns NaN.Below are the programs to illustrate the Math.Cos() method.Program 1: To show the working of Math.Cos() method. CSharp // C# program to demonstrate working // Math.Cos() method using System; class Geeks { // Main Method public static void Main(String []args) { double a = 70; // converting value to radians double b = (a * (Math.PI)) / 180; // using method and displaying result Console.WriteLine(Math.Cos(b)); a = 50; // converting value to radians b = (a * (Math.PI)) / 180; // using method and displaying result Console.WriteLine(Math.Cos(b)); a = 73; // converting value to radians b = (a * (Math.PI)) / 180; // using method and displaying result Console.WriteLine(Math.Cos(b)); a = 77; // converting value to radians b = (a * (Math.PI)) / 180; // using method and displaying result Console.WriteLine(Math.Cos(b)); } } Output: 0.342020143325669 0.642787609686539 0.292371704722737 0.224951054343865 Program 2: To show the working of Math.Cos() method when the argument is NaN or infinity. CSharp // C# program to demonstrate working // Math.Cos() method in infinity case using System; class Geeks { // Main Method public static void Main(String []args) { double positiveInfinity = Double.PositiveInfinity; double negativeInfinity = Double.NegativeInfinity; double nan = Double.NaN; double result; // Here argument is negative infinity, // output will be NaN result = Math.Cos(negativeInfinity); Console.WriteLine(result); // Here argument is positive infinity, // output will also be NaN result = Math.Cos(positiveInfinity); Console.WriteLine(result); // Here argument is NaN, output will be NaN result = Math.Cos(nan); Console.WriteLine(result); } } Output: NaN NaN NaN Comment More infoAdvertise with us Next Article C# | Math.Atan2() Method K Kirti_Mangal Follow Improve Article Tags : Misc C# CSharp-method CSharp-Math Practice Tags : Misc Similar Reads C# | Math.Cosh() Method Math.Cosh() is the inbuilt Math class method which returns the hyperbolic cosine of a given double value argument. Syntax: public static double Cosh(double num) Parameters: num: It is the number whose hyperbolic cos is to be returned and type of this parameter is System.Double. Return Value: The met 2 min read C# | Math.Acos() Method Math.Acos() is an inbuilt Math class method which returns the angle whose cosine is given as a double value argument. If the argument is NaN, then the result will be NaN. Syntax: public static double Acos(double num) Parameter: num: It is the number that represents cosine and type of this parameter 2 min read C# | Math.Atan() Method Math.Atan() is an inbuilt Math class method which returns the angle whose tangent is given as a double value argument. If the argument is NaN, then the result will be NaN. Syntax: public static double Atan(double num) Parameter: num: It is the number that represents a tangent and type of this parame 2 min read C# | Math.Asin() Method Math.Asin() is an inbuilt Math class method which returns the angle whose sine value is given as a double value argument. If the argument is NaN, then the result will be NaN. Syntax: public static double Asin(double num) Parameter: num: It is the number that represents a sine and type of this parame 2 min read C# | Math.Atan2() Method Math.Atan2() is an inbuilt Math class method which returns the angle whose tangent is the quotient of two specified numbers. Basically, it returns an angle θ (measured in radian) whose value lies between -π and π. This is a counterclockwise angle lies between the positive x-axis, and the 5 min read C# | Math.Tan() Method Math.Tan() is an inbuilt Math class method which returns the tangent of a given double value argument(specified angle). Syntax: public static double Tan(double num) Parameter: num: It is the angle(measured in radian) whose tangent is to be returned and the type of this parameter is System.Double. Re 2 min read Like