- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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.Atan2() Method in C# with Examples
The MathF.Atan2() method in C# returns the angle whose tangent is the quotient of two floating-point numbers.
Syntax
Following is the syntax −
public static float Atan2 (float val1, float val2);
Above, val1 is the x-coordinate of a point, whereas val2 is the y-coordinate.
Example
Let us now see an example to implement the MathF.Atan2() method −
using System; public class Demo { public static void Main(){ float val1 = 0.1f; float val2 = 0.9f; Console.WriteLine("Return value = "+(MathF.Atan2(val1,val2))); } }
Output
This will produce the following output −
Return value = 0.1106572
Example
Let us now see another example to implement the MathF.Atan2() method −
using System; public class Demo { public static void Main(){ float val1 = 25f; float val2 = 25f; Console.WriteLine("Return value = "+(MathF.Atan2(val1,val2))* (180 / MathF.PI)); } }
Output
This will produce the following output −
Return value = 45
Advertisements
To Continue Learning Please Login
Login with Google