The MathF.Cbrt() method in C# is used to return the cube root of a floating-point value.
Syntax
Following is the syntax −
public static float Cbrt (float val);
Example
Let us now see an example to implement the MathF.Cbrt() method −
using System;
class Demo {
public static void Main(){
float val1 = 64f;
Console.WriteLine("Cube root = "+MathF.Cbrt(val1));
}
}Output
This will produce the following output −
Cube root = 4
Example
Let us now see another example to implement the MathF.Cbrt() method −
using System;
class Demo {
public static void Main(){
float val1 = 12.67f;
Console.WriteLine("Cube root = "+MathF.Cbrt(val1));
}
}Output
This will produce the following output −
Cube root = 2.331268