0

(C++) Any way to rise a number to its square ?

I'm searching for a fonction possibly being in the C++ cmath library.

12th Dec 2016, 5:38 PM
Samy M
Samy M - avatar
3 Antworten
+ 1
with math.h: int n; int sqrtN = sqrt(n); int powN = pow(n,sqrtN); powN its n elevated to N sqrtt
12th Dec 2016, 8:48 PM
Aldo Alexandro Vargas Meza
Aldo Alexandro Vargas Meza - avatar
0
Just multiple the variable by itself. eg. x *= x or x = x * x
14th Dec 2016, 9:19 PM
John K
John K - avatar
- 1
pow(a, a*a) will work,
12th Dec 2016, 5:58 PM
Morpheus
Morpheus - avatar