To take the arccosine of a number in C#, you can use the Math.Acos()
function from the System
namespace. The Math.Acos()
function returns the angle whose cosine is the specified number.
Here's an example:
main.cs115 chars4 lines
Output:
main.cs52 chars2 lines
Note that the Math.Acos()
function returns the angle in radians. If you want to convert the angle to degrees, you can multiply it by 180/Math.PI
.
gistlibby LogSnag