Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Semrush - keyword research tool

Linux Foundation Training and Certification

Teach Your Child To Read

Disclosure: My content contains affiliate links.

32,307 questions

42,481 answers

573 users

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

*/

 



Learn & Practice Python
with the most comprehensive set of 13 hands-on online Python courses
Start now


answered Sep 2 by avibootz

Related questions

...