← Problem book: C
Lesson 92 of 96 · 10 XP
Power with recursion
Theory and problem statement
Machine translation, not yet reviewed by a native speaker.
Write a recursive function power(a, n): a⁰ = 1, and aⁿ = a · aⁿ⁻¹. Read a and n (0 ≤ n ≤ 20, the answer is at most a billion) and print aⁿ.
Example
Input:
2 10
Output:
1024
Sign up for free to solve this task right in your browser: code editor, running, test checks and hints.