+ 2
How I can print 1 to 100 without using loops in c/c++
6 ответов
+ 4
@Tobias, that's a recursive function.
Good idea.
+ 3
https://code.sololearn.com/cwL2Wi2b97ZW/#cpp
Using recurse to print.
Interestingly, if you switch the cout and recurse it will change from descend to ascending; because the functions execution is then reversed.
+ 2
What are loops used for? They print from 1 to 100, or reading all the lines from a file, or go through characters in a string.
The reasons why we use loops is to help us with this very problem: Make recursive work, less work; Help us analise a ton of words without having to type 1000 lines of code.
I would still recommend using a loop
0
I don't know any option other than loops and direct printing.
0
Type everything one by one
- 4
only option is probably directly typing it up