Here, the opening brace is placed on the line following the for. This is strictly a matter of taste and has no effect on the program.
The next triangular number is calculated by simply adding the value of n to the previous triangular number. The first time through the for loop, the previous triangular number is 0, so the new value of triangular Number when n is equal to 1 is simply the value of n, or 1. The values of n and triangular Number are then displayed, with an appropriate number of blank spaces inserted into the format string to ensure that the values of the two variables line up under the appropriate column headings.