+ 4

Is there any other way

#include <iostream> #include<math.h> using namespace std; int main() { int x; pow(x,3)=8; cout<<x; return 0; }/*i have to find number which is powered by 3 is this correct way*/

13th Mar 2019, 11:22 AM
Ahmad Raza
Ahmad Raza - avatar
5 Réponses
+ 7
x = pow(8, 1.0/3); Yeah, so basically, you raise the resulting number to the power of the reciprocal of the power.
13th Mar 2019, 11:44 AM
Hatsy Rei
Hatsy Rei - avatar
+ 6
... Are you trying to find the cube root of 8?
13th Mar 2019, 11:34 AM
Hatsy Rei
Hatsy Rei - avatar
14th Mar 2019, 5:19 AM
Sonic
Sonic - avatar
+ 3
I want the number which is about to power if I know power and result after powering that number
13th Mar 2019, 11:37 AM
Ahmad Raza
Ahmad Raza - avatar
+ 3
Just a tip: ensure that you use a double/float type (e.g. by using decimal points) in the exponent when using fractional powers such as in cube roots like what Hatsy Rei did.
14th Mar 2019, 3:43 AM
Sonic
Sonic - avatar