



Formatted Output WRITE statement in the program should be replaced with one like
this:
WRITE(UNIT=*, FMT='(1X,I9,F11.2)') IYEAR, AMOUNT
The amended program will then produce a neater tabulation:
Enter amount, % rate, years 2000, 9.5, 5 Annual repayments are 520.8728 End of Year Balance 1 1669.13 2 1306.82 3 910.10 4 475.68 5 .00 |
1X, is needed to cope with the carriage-control convention: it provides an additional
blank at the start of each line which is later removed by the Fortran system. There is
no logical explanation for this: it is there for compatibility with very early Fortran
system. The remaining items specify the layout of each number: I10 specifies that the
first number, an integer, should be occupy a field 10 columns wide; similarly
F11.2 puts the second number, a real (floating-point) value, into a field 11
characters wide with exactly 2 digits after the decimal point. Numbers are
always right-justified in each field. The field widths in this example have
been chosen so that the columns of figures line up satisfactorily with the
headings.