## power1 – Exponentiation (easy version)

Write a program that performs integer exponentiation of a base b to the power of n.

bⁿ = b × b × … × b where b is repeated n times

for example

2⁵ = 2 × 2 × 2 × 2 × 2 = 32

### Input and output

Input will contain two integers b and n where 0 < b, n ≤ 9

Output should contain a single integer indicating the value of bⁿ.

#### Example input 1

``````2 5
``````

#### Example output 1

``````32
``````

#### Example input 2

``````5 2
``````

#### Example output 2

``````25
``````

#### The `power` function

Your program should contain a `power` function that takes two integers and returns an integer. The first integer argument should be the base and the second the exponent. Please refer to the information for your chosen language:

• C prototype: `int power(int b, int n);`
• Haskell type: `power :: Int -> Int -> Int`
• Python definition: `def power(b, n):`
• C++ prototype: `int power(int b, int n);`
• C# prototype: `public static int Power(int b, int e)`
• Java definition: `public static int power(int b, int e)` in a public class `Power`
• JavaScript definition: `function power(b, e)`
• Lua definition: `function power (b, e)`
• Ruby definition: `def power(b, e)`

You should perform the exponentiation as a series of multiplications. For this exercise, you should restrain from using your programming languages' built-in exponentiation functions.

The `power` function should not print anything. It should just perform the computation and return an integer. The function and input/output processing must exist in the same program. Create a single submission with the function and main program. If you’re confused, try earning a partial score first.

Specifically for this exercise when using Python, JavaScript, Lua or Ruby, avoid using `sys.exit()`, `process.exit()`, `os.exit()` or `exit`, as your program is appended with some extra assertions in one of the test sets.

### Scoring

• 2/12: works for the above examples albeit in an incorrect format
• 4/12: works for the above examples in the correct format
• 8/12: works for other examples
• 12/12: implements the `power` function

try first: factorial1

try next: fibonacci1