32 lines
646 B
Plaintext
32 lines
646 B
Plaintext
PROGRAM "Floyd's triangle"
|
|
VERSION "0.0001"
|
|
|
|
DECLARE FUNCTION Entry ()
|
|
DECLARE FUNCTION FloydTriangle (n)
|
|
|
|
FUNCTION Entry ()
|
|
FloydTriangle (5)
|
|
PRINT
|
|
FloydTriangle (14)
|
|
END FUNCTION
|
|
|
|
FUNCTION FloydTriangle (fila)
|
|
DIM numColum[fila]
|
|
FOR colum = 1 TO fila
|
|
t$ = STR$(colum + fila * (fila - 1) / 2)
|
|
numColum[colum] = LEN(t$)
|
|
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]); " ";
|
|
INC thisNum
|
|
NEXT colum
|
|
PRINT
|
|
NEXT r
|
|
END FUNCTION
|
|
END PROGRAM
|