C# Math Cos

Description

Math Cos returns the cosine of the specified angle.

Syntax

Math.Cos has the following syntax.


public static double Cos(
  double d
)

Parameters

Math.Cos has the following parameters.

  • d - An angle, measured in radians.

Returns

Math.Cos method returns The cosine of d. If d is equal to NaN, NegativeInfinity, or PositiveInfinity, this method returns NaN.

Example

The following code shows how to use Math.Cos method.


using System;/*from  w ww  . j a va  2s  .  c o  m*/

public class MainClass{
  public static void Main(String[] argv){  

    
    System.Console.WriteLine(Math.Cos(0.5));

  }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version