MathF.Pow() Method in C# with Examples
Last Updated :
04 Apr, 2019
In C#, MathF.Pow(Single, Single) is a MathF class method. This method is used to calculate a number raise to the power of some other number.
Syntax: public static float Pow (float x, float y);
Parameters:
x: It is a single-precision floating-point number which is to be raised to a power and type of this parameter is System.Single.
y: It is a single-precision floating-point number which specifies a power or exponent and type of this parameter is System.Single.
Return Type: The function returns the number base raised to the power. The return type of this method is System.Single
Example:
using System;
class GFG {
static public void Main()
{
float pow_ab = MathF.Pow(8f, 4f);
Console.WriteLine(pow_ab);
float pow_tt = MathF.Pow(7.5f, 2f);
Console.WriteLine(pow_tt);
float pow_t = MathF.Pow(1234f, 7f);
Console.WriteLine(pow_t);
}
}
|
Output:
4096
56.25
4.357186E+21
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...