C++ cbrt()

Last Updated On Monday 18th Apr 2022

cbrt math

The C++ cbrt() function returns the cube root of a number and it takes a single argument whose cube root is to be calculated.




The cbrt() function takes a one argument. The argument can be of int, double, long double or long long type.

Return value

Returns the cube root of the given argument.


cbrt() prototype [As of C++ 11 standard]

	double cbrt(double x);
float cbrt(float x);
long double cbrt(long double x);
double cbrt(T x); // For integral type

cube root c

Example 1 : C++ cbrt()

	#include <stdio.h>
#include <math.h>

int main () {
  double param, result;
  param = 44;
  result = cbrt(param);
  printf ("cbrt (%f) = %f\n", param, result);
  return 0;


	cbrt (44.000000) = 3.530348

cube root in c

Example 2 : C++ cbrt() with long

	#include <iostream>
#include <cmath>
using namespace std;

int main() {
    long x = 45678912;
    double result = cbrt(x);
    cout << "Cube root of " << x << " is " << result << endl;
    return 0;


	Cube root of 45678912 is 357.469