How do i print Number from 1 to N without using any loop? | Sololearn: Learn to code for FREE!

+4

How do i print Number from 1 to N without using any loop?

c++ c

4/19/2021 12:39:59 PM

Deepak Kumar

5 Answers

New Answer

+2

1. Sentinels are another way. 2. Functions are another way. 3. Objects are another way. 4. Events and or listeners are another way. You just need something just robust enough to "lay down another piece of track."

+7

Recursion is your key .

+3

It is pretty easy in Python, just print an iterable built from use of comprehension. No idea about C/C++. (Edit) Hima is right, recursion is one way.

+2

print all of them manually XD

+1

Phil Andy Graves It's intriguing to learn all the 4 ways from you 👍