What is the difference between a cube and a cube root in C

1 Answer

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

int main() {
    int x = 27;

    //cube = x**3
    //cuberoot = x**(1/3)

    printf("cube = %d\n", (int)pow(x, 3));
    printf("cuberoot = %d\n", (int)round(pow(x, 1.0 / 3.0)));

    return 0;
}



/*
run:

cube = 19683
cuberoot = 3

*/

 



answered Sep 2, 2024 by avibootz

Related questions

1 answer 53 views
1 answer 57 views
1 answer 46 views
...