Floyd's triangle   lists the natural numbers in a right triangle aligned to the left where

 the first row is   1     (unity)
 successive rows start towards the left with the next number followed by successive naturals listing one more number than the line above.


The first few lines of a Floyd triangle looks like this:

 1
 2  3
 4  5  6
 7  8  9 10
11 12 13 14 15



Task

 Write a program to generate and display here the first   n   lines of a Floyd triangle. 
(Use   n=5   and   n=14   rows).
 Ensure that when displayed in a mono-space font, the numbers line up in vertical columns as shown and that only one space separates numbers of the last row.


' version 19-09-2015
' compile with: fbc -s console
 
Sub pascal_triangle(n As UInteger)
 
    Dim As UInteger a = 1, b, i, j, switch = n + 1
    Dim As String frmt, frmt_1, frmt_2
 
    ' last number of the last line
    i = (n * (n + 1)) \ 2
    frmt_2 = String(Len(Str(i)) + 1, "#")
    ' first number of the last line
    i = ((n - 1) * n) \ 2 + 1
    frmt_1 = String(Len(Str(i)) + 1, "#")
 
    ' we have 2 different formats strings
    ' find the point where we have to make the switch
    If frmt_1 <> frmt_2 Then
        j = i + 1
        While Len(Str(i)) = Len(Str(J))
            j =  j + 1
        Wend
        switch = j - i
    End If
 
    Print "output for "; Str(n) : Print
    For i = 1 To n
        frmt = frmt_1
        b = (i * (i + 1)) \ 2
        For j = a To b
            ' if we have the switching point change format string
            If j - a = switch Then frmt = frmt_2
            Print Using frmt; j;
        Next j
        Print
        a = b + 1
    Next i
    Print
 
End Sub
 
' ------=< MAIN >=------
 
pascal_triangle(5)
 
pascal_triangle(14)
 
 
' empty keyboard buffer
While Inkey <> "" : Wend
Print : Print "hit any key to end program"
Sleep
End