Jump to content

Floyd's triangle: Difference between revisions

Floyd's triangle en QBasic and Yabasic
(Floyd's triangle en QBasic and Yabasic)
Line 1,402:
79 80 81 82 83 84 85 86 87 88 89 90 91
92 93 94 95 96 97 98 99 100 101 102 103 104 105</pre>
 
==={{header|BASIC256}}===
{{works with|BASIC256|2.0.0.11}}
Line 1,447 ⟶ 1,448:
92 93 94 95 96 97 98 99 100 101 102 103 104 105
</pre>
 
==={{header|BBC BASIC}}===
<lang bbcbasic> n = 14
Line 1,589 ⟶ 1,591:
79 80 81 82 83 84 85 86 87 88 89 90 91
92 93 94 95 96 97 98 99 100 101 102 103 104 105</pre>
 
==={{header|QBasic}}===
<lang QBasic>SUB FloydTriangle (fila)
DIM numColum(fila)
FOR colum = 1 TO fila
numColum(colum) = LEN(STR$(colum + fila * (fila - 1) / 2))
NEXT colum
PRINT "output for "; STR$(fila): PRINT
thisNum = 1
FOR r = 1 TO fila
FOR colum = 1 TO r
PRINT RIGHT$(" " + STR$(thisNum), numColum(colum)); " ";
thisNum = thisNum + 1
NEXT colum
PRINT
NEXT
END SUB
 
FloydTriangle (5)
PRINT
FloydTriangle (14)</lang>
 
==={{header|Yabasic}}===
<lang freebasic>sub FloydTriangle (fila)
dim numColum(fila)
for colum = 1 to fila
numColum(colum) = len(str$(colum + fila * (fila - 1) / 2))
next colum
print "output for ", str$(fila), "\n"
thisNum = 1
for r = 1 to fila
for colum = 1 to r
print right$(" " + str$(thisNum), numColum(colum)), " ";
thisNum = thisNum + 1
next colum
print
next
end sub
 
FloydTriangle (5)
print
FloydTriangle (14)</lang>
 
=={{header|Batch File}}==
2,136

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.