Countdown (Recursion)

Write a recursive function that prints n down to 1, then print Liftoff!.

Input: One integer 1 ≤ n ≤ 100.

Output: n lines counting down, then Liftoff!.

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

  • Print n, then call yourself with n − 1. Stop at 0.

More Recursion practice