How we take a exponent for any number?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How we take a exponent for any number??

19th Mar 2017, 5:06 PM
Karan Gupta
Karan Gupta - avatar
2 Answers
+ 3
Do you mean raising a number to some n-th power? If so, you should use pow(a,b) –remember to include cmath library. #include <iostream> using namespace std; #include <cmath> using namespace std; int main() { cout<<pow(5,3)<<endl; return 0; }
23rd Mar 2017, 6:38 AM
Álvaro
+ 1
thanks
1st Apr 2017, 5:07 PM
Karan Gupta
Karan Gupta - avatar