MathF.Atan() Method in C# with Examples


The MathF.Atan() method in C# is used to return the angle whose tangent is given as a float value argument.

Syntax

Following is the syntax −

public static float Atan (float val);

Above, Val is the floating-point value.

Example

Let us now see an example to implement the MathF.Atan() method −

using System;
public class Demo {
   public static void Main(){
      float val1 = 1.2f;
      float val2 = 45.5f;
      Console.WriteLine("Angle (val1) = "+(MathF.Atan(val1)));
      Console.WriteLine("Angle (val2) = "+(MathF.Atan(val2)));
   }
}

Output

This will produce the following output −

Angle (val1) = 0.876058
Angle (val2) = 1.548822

Example

Let us now see another example to implement the MathF.Atan() method −

using System;
public class Demo {
   public static void Main(){
      float val1 = 0.1f;
      float val2 = 0.9f;
      Console.WriteLine("Angle (val1) = "+(MathF.Atan(val1)));
      Console.WriteLine("Angle (val2) = "+(MathF.Atan(val2)));
   }
}

Output

This will produce the following output −

Angle (val1) = 0.09966865
Angle (val2) = 0.7328151

Updated on: 13-Nov-2019

42 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements