How can I do pattern program?

I have done pattern program like as follow:



BUT I am not getting idea to do pattern program like as follow:

0
1 2
3 4 5
6 7 8 9

How can I do this program?

Kind regards.

Regis d’Aubarede wrote in post #1148438:

i=0
1.upto(10) {|len| 1.upto(len){ print " %2d" % i ; i+=1} ; puts}

That’s actually not an answer to the question.

i=0
1.upto(10) {|len| 1.upto(len){ print " %2d" % i ; i+=1} ; puts}

0
1 2
3 4 5
6 7 8 9
10 11 12 13 14
15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31 32 33 34 35
36 37 38 39 40 41 42 43 44
45 46 47 48 49 50 51 52 53 54

Robert K. wrote in post #1148441:

That’s actually not an answer to the question.

‘Thatsactuallynotananswertothequestion’ is not an answer to the
question

:slight_smile: