Print numbers from 1 to n using recursion

Given a positive number N, Our goal is to print number from 1...N without using any loops. So we can use recursion to solve this problem. Because loop are not allowed.

 Example N = 10
 (1 to 10) :  1 2 3 4 5 6 7 8 9 10
Example N = 20
 (1 to 20) :  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Here given code implementation process.




Comment

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment







© 2022, kalkicode.com, All rights reserved