+ 1

Print all natural numbers upto N without using semi-colon.

use the idea of recursively calling main function.

21st Apr 2019, 8:20 AM
Michael Mamo
Michael Mamo - avatar
4 Réponses
+ 6
Using Python is a classic 😂. But this worked on code playground for C++ without using return. Not sure in other compilers. https://code.sololearn.com/cd365bOsxZgC/?ref=app
22nd Apr 2019, 8:53 AM
Sonic
Sonic - avatar
+ 4
Use python // No semicolon needed
21st Apr 2019, 8:24 AM
Rstar
Rstar - avatar
+ 1
I feel like this could work in real life: #include <iostream> int main(int argc, char* argv[]) { while(std::cout << argc-- && argc) {} } To print the numbers up to 1000, call the program and provide 999 command line arguments
21st Apr 2019, 8:36 AM
Anna
Anna - avatar
0
Rstar gud but how abt if u r coding with c++
21st Apr 2019, 8:25 AM
Michael Mamo
Michael Mamo - avatar