+ 2

Print 1 to 100 without loop or recursion or printing each number one by one ?

can you suggest a possible way in your favourite programming language? Desired output: 1 2 3 ...99 100 Rules: *No loops *No recursions *No one by one typing I.e. print("1 2 3 .. 99 100

7th Jan 2017, 10:52 AM
heduson satchi
heduson satchi - avatar
8 Respuestas
+ 3
you can in java convert array to string and print it Arrays.toString(array)
7th Jan 2017, 11:13 AM
Stefan Milosavljevic
Stefan Milosavljevic - avatar
+ 3
Ruby: a = (1..100) puts a.to_a
8th Jan 2017, 9:27 PM
Denisov Stanislav
Denisov Stanislav - avatar
+ 3
num=list(range (1,100)) print(num )
18th Jan 2017, 3:50 PM
Adi Madan
Adi Madan - avatar
+ 2
It can be done using templates in c++. See: http://www.geeksforgeeks.org/output-of-c-program-set-18-3/
7th Jan 2017, 1:02 PM
Andrii Voloshchuk
Andrii Voloshchuk - avatar
+ 1
enter 100 nums into array. print array
7th Jan 2017, 11:05 AM
Stefan Milosavljevic
Stefan Milosavljevic - avatar
+ 1
int [] array = {1,2,3...99,100}
7th Jan 2017, 11:10 AM
Stefan Milosavljevic
Stefan Milosavljevic - avatar
+ 1
heduson, 'print without loops' - we can use loops, but we can't print by them
7th Jan 2017, 11:12 AM
Maxim Kuzmin
Maxim Kuzmin - avatar
- 2
int num=1 while (num,=100) { cout<<num<<endl; num++ } that code is the simplest
8th Jan 2017, 10:55 PM
Dillon Brandon
Dillon Brandon - avatar