C Standard Library

C <math.h> - cbrt() Function



The C <math.h> cbrt() function returns the cube root of the given number.

Syntax

double cbrt (double x);
float cbrtf (float x);
long double cbrtl (long double x);

Parameters

x Specify a number.

Return Value

Returns the cube root of the specified number.

Example:

In the example below, cbrt() function is used to find out the cube root of the given number.

#include <stdio.h>
#include <math.h>
 
int main (){
  printf("%lf\n", cbrt(25));
  printf("%lf\n", cbrt(30));
  printf("%lf\n", cbrt(35.5));
  printf("%lf\n", cbrt(-25));  
  return 0;
}

The output of the above code will be:

2.924018
3.107233
3.286569
-2.924018

❮ C <math.h> Library