- 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.Pow() Method in C# with Examples
The MathF.Pow() method in C# is used to compute a number raise to the power of another number.
Syntax
Following is the syntax −
public static float Pow (float val1, float val2);
Above, val1 is the floating-point number raised to a power. The val2 parameter is the power or exponent.
Example
Let us now see an example to implement the MathF.Pow() method −
using System; public class Demo { public static void Main(){ float val1 = 5.00f; float val2 = 3.00f; Console.WriteLine("MathF.Pow() = "+MathF.Pow(val1, val2)); } }
Output
This will produce the following output −
MathF.Pow() = 125
Example
Let us now see another example to implement the MathF.Pow() method −
using System; public class Demo { public static void Main(){ float val1 = 15.20f; float val2 = 3.10f; Console.WriteLine("MathF.Pow() = "+MathF.Pow(val1, val2)); } }
Output
This will produce the following output −
MathF.Pow() = 4610.149
Advertisements