+ 7
Hi friend, I need to know how to make power of an number in C++?
Is this valid code: power(2,5); //2^5
7 Answers
+ 3
using the (pow) function
but you need to include <math.h> first
example:
#include <stdio.h>
#include <math.h>
int main ()
{
printf ("12.34 ^ 56.78 = %f\n", pow (12.34, 56.78) );
return 0;
}
+ 6
Thx @Ahmed you are right.
Thx @Joshua but your code not valid in c++ maybe in Javascript or python.
+ 6
Hi friend . (surprise) .. My Code is now public please see it.
Your names is include in it.
https://code.sololearn.com/cjNOwm9Q0vt3/?ref=app
+ 2
2**5 in python
+ 2
for more reference:- http://en.cppreference.com/w/cpp/numeric/math/pow
+ 2
just use ^ this, it will work for u
+ 1
2**5 i think........