Live Batches
Masterclasses
Menu
Free Courses
Account
Login / Sign Up
Problem Submissions Solution

Print Numbers from 1 to N

Difficulty: Easy

Acceptance: 75.00%

Points: 20.00

You are given an integer n. Your task is to print all the numbers starting from 1 up to n. The solution must be implemented using recursion only, and you are not allowed to use any looping constructs such as for or while.

All the numbers should be printed in increasing order, on a single line, with each number separated by a space. 

Topics

Companies

Articles

Examples:

N/A

Constraints:
  • 1 = n = \(10^{3}\)
Companies:
Amazon Microsoft Atlassian
Topics:
Recursion
Locked Content
Access Restricted: Please Login to access the code editor and test cases.