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

21 lines
463 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
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)