+ 1

/Calculate X raised yo power Y using different methods while :do while :for

https://code.sololearn.com/cxkCV42m7OS7/?ref=app

21st Jan 2023, 6:32 PM
MO SHERIF
1 Réponse
+ 2
Cool Mo, You can also use the function in the cmath library… #include <iostream> #include <cmath> using namespace std; int main() { float x,y; cin >> x >> y; cout << pow(x, y); return 0; } P.s: Your examples work with integers (although you use floats) - 2^2.5 (2 to the power of 2.5) will give the wrong result.
21st Jan 2023, 6:50 PM
DavX
DavX - avatar