I know how to obtain the square root of a number using the sqrt function.
sqrt
How can I obtain the cube root of a number?
Actually the round must go for the above solutions to work.
The Correct solution would be
ans = round(pow(n, 1./3.));