20 lines
465 B
Plaintext
20 lines
465 B
Plaintext
100 print chr$(14);chr$(147);"Floyd's triangle"
|
|
110 print "How many rows? ";
|
|
120 open 1,0:input#1,ro$:close 1:print
|
|
130 ro=val(ro$):if ro<1 then 110
|
|
140 li=ro*(ro+1)/2
|
|
150 dim w(ro-1)
|
|
160 n=li-ro+1
|
|
170 for i=0 to ro-1:w(i)=len(str$(n)):n=n+1:next i
|
|
180 n=1
|
|
190 for i=1 to ro
|
|
200 : for j=0 to i-1
|
|
210 : n$=mid$(str$(n),2)
|
|
220 : if len(n$)<w(j) then for k=1 to w(j)-len(n$):print" ";:next k
|
|
230 : print n$;
|
|
240 : n=n+1
|
|
250 : next j
|
|
260 : print
|
|
270 next i
|
|
280 end
|