Mark As Completed Discussion

Good evening! Here's our prompt for today.

Given a number x and an integer n, find the value of x raised to the power n ( xn ).

Question

For example, consider the following two numbers,

SNIPPET
1x = 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

Try to solve this here or in Interactive Mode.

How do I practice this challenge?

JAVASCRIPT
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment

We'll now take you through what you need to know.

How do I use this guide?

Access all course materials today

The rest of this tutorial's contents are only available for premium members. Please explore your options at the link below.

Returning members can login to stop seeing this.