+ 4

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

19th Apr 2021, 12:39 PM
Deepak Kumar
Deepak Kumar - avatar
5 Réponses
+ 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."
19th Apr 2021, 1:51 PM
Phil Andy Graves
Phil Andy Graves - avatar
+ 7
Recursion is your key .
19th Apr 2021, 1:03 PM
Hima
Hima - avatar
+ 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.
19th Apr 2021, 12:56 PM
Ipang
+ 2
print all of them manually XD
19th Apr 2021, 1:16 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 1
Phil Andy Graves It's intriguing to learn all the 4 ways from you 👍
21st Apr 2021, 5:51 AM
Ipang