- 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.Cos() Method in C# with Examples
The MathF.Cos() method in C# returns the cosine of a given float value argument.
Syntax
Following is the syntax −
public static float Cos (float val);
Above, Val is the floating-point value.
Example
Let us now see an example to implement the MathF.Cos() method −
using System; class Demo { public static void Main(){ float val1 = 70f; float res = (val1 * (MathF.PI)) / 180; Console.WriteLine(MathF.Cos(res)); } }
Output
This will produce the following output −
0.34202
Example
Let us now see another example to implement the MathF.Cos() method −
using System; class Demo { public static void Main(){ float val1 = 90f; float res = (val1 * (MathF.PI)) / 180; Console.WriteLine(MathF.Cos(res)); } }
Output
This will produce the following output −
-4.371139E-08
Advertisements
To Continue Learning Please Login
Login with Google