MathF.Cbrt() Method in C# with Examples


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

Updated on: 13-Nov-2019

29 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements