![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
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
Math.Atan2() Method in C#
The Math.Atan2() method in C# is used to return the angle whose tangent is the quotient of two specified numbers.
Syntax
Following is the syntax −
public static double Atan2 (double val1, double val2);
Above, val1 is the y coordinate, whereas val2 is the x coordinate.
Example
Let us now see an example to implement Math.Atan2() method −
using System; public class Demo { public static void Main(){ double val1 = 3.0; double val2 = 1.0; double angle, radians; radians = Math.Atan2(val1, val2); angle = radians * (180/Math.PI); Console.WriteLine("Result = "+angle); } }
Output
This will produce the following output −
Result = 71.565051177078
Example
Let us see another example to implement Math.Atan2() method −
using System; public class Demo { public static void Main(){ double val1 = 0; double val2 = 5; double angle, radians; radians = Math.Atan2(val1, val2); angle = radians * (180/Math.PI); Console.WriteLine("Result = "+angle); } }
Output
This will produce the following output −
Result = 0
Advertisements