Power Up (Functions)

Write power(base, exp) using a loop (no built-in power). Read base exp and print the result.

Input: Two integers, 0 ≤ exp ≤ 30, |base| ≤ 4.

Output: base raised to exp.

Difficulty: Easy. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • Start from 1 and multiply exp times.

More Functions practice