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
MathF.Acos() Method in C# with Examples
The MathF.Acos() method in C# is used to return the angle whose cosine is given as a float value argument.
Syntax
Following is the syntax −
public static float Acos (float val);
Above, Val is the floating-point number.
Example
Let us now see an example to implement the MathF.Acos() method −
using System;
public class Demo {
public static void Main(){
float val1 = 0.1f;
float val2 = 0.9f;
Console.WriteLine("Angle (val1) = "+(MathF.Acos(val1)));
Console.WriteLine("Angle (val2) = "+(MathF.Acos(val2)));
}
}
Output
This will produce the following output −
Angle (val1) = 1.470629 Angle (val2) = 0.4510269
Example
Let us now see another example to implement the MathF.Acos() method −
using System;
public class Demo {
public static void Main(){
float val1 = 2.5f;
float val2 = 5.0f;
Console.WriteLine("Angle (val1) = "+(MathF.Acos(val1)));
Console.WriteLine("Angle (val2) = "+(MathF.Acos(val2)));
}
}
Output
This will produce the following output −
Angle (val1) = NaN Angle (val2) = NaN
Advertisements