Power of a Number
Read at your own pace. Code execution, quizzes, progress tracking, and the AI tutor are available in the interactive view with JavaScript enabled.
Question
Given a number x and an integer n, find the value of x raised to the power n ( xn ).

For example, consider the following two numbers,
x = 2.1, n = 3
If the number 2.1 is multiplied by itself 3 times, then the answer is 9.261 (rounded to the nearest 100), which is 2.1 raised to the power 3.
Constraints
- -100.0 < x < 100.0
- -231 <= n <= 231-1
- -104 <= xn <= 104
CONTINUE WITH ALGODAILY PREMIUM
Keep going with the complete tutorial.
Unlock the remaining explanations and exercises, alongside the full learning library.
Explore Premium →