
Printf("Cube root of %.2f is: %.2f", n, cube_root) Įxplanation // Finding cube root using pow() Function

Finding cube root using pow() Function

C Program to Find Cube Root of a Number Using pow() FunctionĬ Program // C Program to Find Cube Root of a Number Using pow() Function The %.2f format specifier is used to limit the result to 2 decimal places. The cube root calculated above using the cbrt() function is printed on the screen using printf() function. Printf("Cube root of %.2f is: %.2f", num, root) The number obtained gets stored in the root named variable. This function is defined in the math.h header file. The cbrt() function takes a single argument and returns the cube root. Computing cube root using cbrt() function The entered value gets stored in the num named variable. Then, this program prompts the user to enter a number to find the cube root. Printf("Enter a number to find cube root: ") In the meantime, get a pencil and see if you can make this expression equal to two.In the above program, we have declared two float data type variables named num and root respectively. I want to show you how to denest these, which is kinda similar to factoring.īut Socratic says I'm intimidating you all, so I'll stop here and continue this in some future answer. Here we're supposed to get two but we get the sum of two cube roots of complex numbers. We write #1# using Euler's Identity to the #2k# power for integer #k#. The way we find them is by multiplying #z# by 1 before exponentiating.

In general, any non-integer exponent, like #1/3# here, gives rise to multiple values. (Hopefully they do it this way in precalc it makes everything easy).Įvery non-zero complex number has three cube roots.

Taking the cube root is easy if we have our complex number in polar coordinates. What's left after Algebra I, Algebra II, Geometry and Trigonometry? But let's assume it's a time to get deep about what the math we've been doing really means. Unfortunately I can only get to the question in the usual space allotted. This is an important question, or is at least hinting at one.
