Q:

# Write a C++ Program to find Cube Root of a Number

belongs to collection: C++ Number Solved Programs

Write a C++ Program to find Cube Root of a Number. Here’s simple Program to find Cube Root of a Number using pow( ) function in C++ Programming Language.

To find cube root of any number we need to find 0.3 power of any number. For example : : if you need to find cube root of 27, then calculate 0.3 power of 27, result is 3.

And one another method for this program is use cbrt() function it is pre-defined in math.h header file.

cbrt() is a predefined function in math.h header file, it is used for calculate cube root of any number.

Here is source code of the C++ Program to find Cube Root of a Number using pow( ) function. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.

### SOURCE CODE : :

``````/*  C++ Program to find Cube Root of a Number using pow( ) function  */

#include<iostream>
#include<math.h>
using namespace std;

int main()
{
int num;
double ans;

cout<<"Enter number which u want to find cube root :: ";
cin>>num;

ans=(double)pow((double)num,(double)1/(double)3);

cout<<"\nCube Root of [ "<<num<<" ] is :: "<<ans<<"\n";

return 0;
}``````

### Output : :

```/*  C++ Program to find Cube Root of a Number using pow( ) function */

Enter number which u want to find cube root :: 125

Cube Root of [ 125 ] is :: 5

Process returned 0```

Above is the source code for C++ Program to find Cube Root of a Number using pow( ) function which is successfully compiled and run on Windows System.The Output of the program is shown above .