Raising a number to the power of n
visquis
Posted messages
1
Status
Member
-
ellana29460 Posted messages 805 Status Member -
ellana29460 Posted messages 805 Status Member -
La fonction qui permet de calculer la puissance d'un nombre est la fonction exponentielle.
1 answer
-
```html #include <math.h>
pow(power, number);
I believe the function is of type float. ```-
Hi visquis, ellana29460,
It's indeedpow
, defined inmath.h
.
But it's first the base and then the exponent. As for the type, the return value (the result) is adouble
, like its parameters.
The prototype:
double pow (double base, double exponent);
http://www.cplusplus.com/reference/cmath/pow/
If you need other types, and programming in C99 doesn't bother you, you can use the macro of the same name defined in tgmath.h.
Dal -
-