I want to to display the numbers in the following format using smalltalk code
1
1 2
1 2 3
1 2 3 4
I wrote the following code
| i j y k |
i :=1.
j :=1.
y:= ('y' at: 1 put: $ )out.
(i<=4)ifTrue: [
i to: 4 by:1 do:[:i |
(j<=i)ifTrue: [
j to: i by: 1 do:[:j |
( j print++y print)out.
]
]
]
]
when i executed the above program, its displaying the numbers in following format
output:
1 ' '
1 ' '
2 ' '
1 ' '
2 ' '
3 ' '
1 ' '
2 ' '
3 ' '
4 ' '
can anyone please help me out in displaying the out in the pyramid format and way to get new line in smalltalk