RosettaCodeData/Task/Floyds-triangle/OxygenBasic/floyds-triangle.basic

28 lines
391 B
Plaintext

function Floyd(sys n) as string
sys i,t
for i=1 to n
t+=i
next
string s=str t
sys le=1+len s
string cr=chr(13,10)
sys lc=len cr
string buf=space(le*t+n*lc)
sys j,o,p=1
t=0
for i=1 to n
for j=1 to i
t++
s=str t
o=le-len(s)-1 'right justify
mid buf,p+o,str t
p+=le
next
mid buf,p,cr
p+=lc
next
return left buf,p-1
end function
putfile "s.txt",Floyd(5)+floyd(14)