13+ C Cube Root Finder Program Examples

This post contains a total of 13+ Hand-Picked C Cube Root Finder Program Examples with Source Code. All these Cube root programs are made using C Programming language.

You can use the source code of these examples with credits to the original owner.

Related Posts

C Cube Root Finder Programs

1. By Tanishq Rawat

Made by Tanishq Rawat. Cube root without using any predefined function. Source

10
Cube Root Of 10.00 is 2.154435
#include<stdio.h>
float num;
#define g(x) ((3*(x)*(x)))
float f(float x)
{
return (((x)*(x)*(x))-num);
}

int main()
{
 float xn,temp,x;
 
 scanf("%f",&num);
 printf("Cube Root Of %.2f is ",num);
 if(num == 0 ) 
 {
 printf("0");
 return 0;
 }
 if(num < 0 ) num=-num,printf("-");

 for(int i=0;;i++)
    if(f(i)*f(i+1)<=0)
    {temp = (2*i+1)/2;break;}


    xn=((temp)-(f(temp)/g(temp)));

    for(int i=0;x!=xn;i++)
    {
    x=xn;
    xn=((xn)-(f(xn)/g(xn)));
    }
    printf("%f",xn);
    return 0;
}

2. By ogoxu

Made by ogoxu. Source

20
2.7144
#include <stdio.h>

int main() {

    int x;
    float y=0;
    scanf("%d",&x);
    //y*y*y=x, y=?
    do{
        y+=0.000001;
    }while(y*y*y<x);
    
    printf("%.4f",y);
    return 0;
}

3. By Bhargav

Made by Bhargav. This C program can only find the perfect cube root, so only integers with perfect cube root can be find using this program.. Source

27
Cube root of 27 is 3.
³√27=3
3Β³=27
#include <stdio.h>

int main() {
    int x,y,i,j,k,a,b,c,u;
    scanf("%d",&x);
    for(i=1;i<x;i++)
    {
        for(j=1;j<x;j++)
        {
            for(k=1;k<x;k++)
            {
                a=i;
                b=j;
                c=k;
                y=a*b*c;
                if(a==c && b==c && a==b && y==x)
                {
                    u=1;
                    printf("Cube root of %d is %d.\n",x,a);
                    printf("³√%d=%d\n",x,a);
                    printf("%dΒ³=%d",a,x);
                }
            }
        }
    }
    if(u!=1)
    {
        printf("There is no perfect square root for this number.");
    }
    return 0;
}

4. By Abdullah Al Noman Sakib

Made by Abdullah Al Noman Sakib. Cube root finder program using Pow(), Change 27.0 number in the source code to the number you want the cube root of. Source

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

int main() {
printf ("%f" ,pow(27.0 ,1.0/3.0));
    return 0;
}

5. By MOHAMED MUHSIN CH

Made by MOHAMED MUHSIN CH. Source

find Cube root of a number :

Enter a number to find Cube root  : 14
Cube root of 14 = 2.41
#include<stdio.h>
#include<math.h>

int main() {


//clrscr();

int number;
float cube_rt;
 
 
   printf("\nfind Cube root of a number : \n\n");
 
   
   scanf("%d",&number);
   printf("Enter a number to find Cube root  : %d\n",number );
   
    cube_rt = pow(number,0.3333333);
   
   printf("Cube root of %d = %.2f",number,cube_rt);
   

 return 0;

}

6. By MANSOOR PASHA

Made by MANSOOR PASHA. Source

5
You have entered 5.000000
The cube root of number is 
1.709976
#include <stdio.h>
#include<math.h>

int main() {
    float n;
    scanf("%f",&n);
    printf("You have entered %f\n",n);
    printf("The cube root of number is \n");
    if(n>0){
    float a=log10(n);
    a/=3;
    a=pow(10,a);
    printf("%f",a);
    }
    else{
    n=n-(2*n);
    float a=log10(n);
    a/=3;
    a=pow(10,a);
    printf("-%f",a);
        
    }
    return 0;
}

7. By Annisa Rahmawati

Made by Annisa Rahmawati. Basic C cube root finder program. Source

n = 
3
result : 1.442250
#include"stdio.h"
double cuberoot(double n)
{
    double x =1, e=1;
    while((e<0?-e:e)>10e-14)
    {
        e=(x*x*x-n)/(3*x*x);
        x=x-e;
    }
    return x;
}
main()
{
    double n;
    printf("n = \n");scanf("%lf",&n);
    printf("result : %lf",cuberoot(n));
}

8. By Nick Mahangi

Made by Nick Mahangi. Enter your number in place of x = 125. Source

The cude root of 125 is 5
#include <stdio.h>

int main() {
    int x = 125; //cube root of number
    
    int result = 0;
    
    for(int y = 0; (y*y*y)!=x; y++)
    {
        result = y+1;
    }
    
    printf("The cude root of %d is %d", x, result);
    
    return 0;
}

9. By lulugo

Made by lulugo. Source

17
The cuberoot of 17.00000 is 2.57129.
#include <stdio.h>

double myabs(double d)
{
    return d > 0 ? d : -d;
}

double cuberoot(double a)
{
    double x0 = 1.0; // start value
    while(1){
        double x1 = (2.0 * x0 + a/(x0*x0))/3.0;
        if(myabs(x1 - x0) < 0.00001)
            break;
        x0 = x1;
    }
    return x0; 
}

int main() {
    double a;
    scanf("%lf",&a);
    double c = cuberoot(a);
    printf("The cuberoot of %.5lf is %.5lf.",a,c);
    return 0;
}

10. By Jonathan Álex

Made by Jonathan Álex. C Program to find the cube root of a number N to a precision of 0.0001 without using any standard functions. Source

Cube Root Checker:

729 --> 9.0000
41 ---> 3.4482
2 ----> 1.2599
#include <stdio.h>

double cubeRoot(int x)
{
    double i;
    for(i=0.00001;i*i*i<x;i+=0.00001);
    return i;
}

int main() {
    printf("Cube Root Checker:\n\n");
    printf("729 --> %.4f\n",cubeRoot(729));
    printf("41 ---> %.4f\n",cubeRoot(41));
    printf("2 ----> %.4f\n",cubeRoot(2));
    
    return 0;
}

11. By Sayeef

Made by Sayeef. Source

enter a number to cube root:
33
the cube root is: 3.2075
#include <stdio.h>

int main() {

    int a;
    float b,c,e=1,f=3,d=(e/f);
    printf("\nenter a number to cube root:");
    scanf("%d", &a);
    c=(float)a;
    b=pow((c), d);
    printf("\nthe cube root is: %.4f", b);
    

    return 0;
}

12. By Sergey Kuzichev

Made by Sergey Kuzichev. Source

Upper bound 3 = 27
Lower bound 2 = 8
Approximate cube root of
10 = 2.154434690031 
#include <stdio.h>
double degree(double n){
    return n*n*n;
}
int main() {
    double num;
    double up_b=0,down_b,t=0,k,j=0.1,i=0;
    scanf("%lf", &num);
    while(degree(up_b) < num){
        t++;
        up_b++;     
    }
    down_b = degree(up_b - 1);
    up_b = degree(up_b);
    t--;
    k=t;
    if(num != up_b){
        while(degree(t) < num){
            t = t + j;
            if(degree(t) > num){
              t = t - j;
              j /= 10; 
              i++;
              if(i == 12) break;
            }
        }
    }
    printf("Upper bound %1.0lf = %1.0lf\n", k+1, up_b);
    printf("Lower bound %1.0lf = %1.0lf\n", k, down_b);
    if(num != up_b)
    printf("Approximate cube root of\n%1.0lf = %1.12lf \n", num, t);
    else printf("Cube root of %1.0lf = %1.0lf", num, k+1);
    
    return 0;
}

13. By Yogesh Jangid

Made by Yogesh Jangid. Source

Enter value you want calculat cubic root
5
Your Answer is 1.709976 
#include<stdio.h>
#include<math.h>

void main() {
   float value;
   printf("This cubic root calcualtor was created by Yogesh Jangid\n");
   printf("Enter value you want calculat cubic root\n");
   scanf("%f",&value);
   printf("Your Answer is %f ",pow(value,0.3333334));
}

14. By Aman Rai

Made by Aman Rai. Basic C Cube root finder program. Source

10
cube root of 10 is 2.15444
#include <stdio.h>

int main() {
   double i, cube;
   
   scanf("%lf",&cube);
   for(i=0.00001;i*i*i<cube;i=i+0.00001);
           printf("cube root of %g is %g",cube,i);
    return 0;
}