![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.Tan() Method in C#
The Math.Tan() method in C# is used to return the tangent of the specified angle.
Syntax
Following is the syntax −
public static double Tan (double val);
Here, Val is the angle.
Example
Let us now see an example to implement Math.Tan() method −
using System; public class Demo { public static void Main(){ double val1 = 30.0; Console.WriteLine(Math.Tan( (val1 * (Math.PI)) / 180 )); } }
Syntax
This will produce the following output −
0.577350269189626
Example
Let us see another example to implement Math.Tan() method −
using System; public class Demo { public static void Main(){ double val1 = 45.0; double val2 = Double.PositiveInfinity; double val3 = Double.NaN; Console.WriteLine(Math.Tan( (val1 * (Math.PI)) / 180 )); Console.WriteLine(Math.Tan(val2)); Console.WriteLine(Math.Tan(val3)); } }
Output
This will produce the following output −
1 NaN NaN
Advertisements