$ filename "FloydTriangle.exe"

'uses rtl32  'Create a 32-bit exe
'uses rtl64  'Create a 64-bit exe

'Otherwise executed by co2.exe + oxygen.dll

#console               'When in cmd mode,
% TryAttachConsole     'will not open extra window for console

uses console

sub triangle(int n)
   print "Floyd's triangle: " n " rows"
   printl  
   int num = 1
   string gap = space(len(str(n * n)) - 1) 
   int last =  n * (n - 1) / 2       
   int row, col
   int colwidth
   for row = 1 to n
      for col = 1 to row
         colwidth = len(str(col + last))
         print right(gap + str(num), colwidth) + " "         
         num += 1
      next
      printl
   next
   printl         
end sub

triangle(5)
triangle(14)

printl "Enter ..."
waitkey