+ 2

Is my math wrong?

5*5*5 gave the right result. but 5 to the 3rd power didnt. https://code.sololearn.com/c7ny2MLKqw2u/?ref=app

30th Sep 2017, 2:35 PM
Gryn T
Gryn T - avatar
7 Answers
+ 4
It's because sololearn's C++ compiler sucks. Try storing it in a float/double, that fixes it.
30th Sep 2017, 2:43 PM
Dennis
Dennis - avatar
+ 3
I checked this code and tried some changes but it always shows 5^3 equals 124. I also want to know Why it shows this output?
30th Sep 2017, 2:46 PM
Lakshay
Lakshay - avatar
+ 2
3^5 = 3*3*3*3*3 =243
30th Sep 2017, 3:03 PM
John Wells
John Wells - avatar
+ 2
thanks! making them into a float helped!
30th Sep 2017, 3:08 PM
Gryn T
Gryn T - avatar
+ 2
Yeah it works now
3rd Oct 2017, 12:51 AM
šŸ‘‘ Prometheus šŸ‡øšŸ‡¬
šŸ‘‘ Prometheus šŸ‡øšŸ‡¬ - avatar