+ 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
8 odpowiedzi
+ 3
you can in java convert array to string and print it
Arrays.toString(array)
+ 3
Ruby:
a = (1..100)
puts a.to_a
+ 3
num=list(range (1,100))
print(num )
+ 2
It can be done using templates in c++. See:
http://www.geeksforgeeks.org/output-of-c-program-set-18-3/
+ 1
enter 100 nums into array. print array
+ 1
int [] array = {1,2,3...99,100}
+ 1
heduson, 'print without loops' - we can use loops, but we can't print by them
- 2
int num=1
while (num,=100)
{
cout<<num<<endl;
num++
}
that code is the simplest