Multiplication tables: Difference between revisions

Content deleted Content added
m →‎{{header|REXX}}: added/changed whitespace and comments, changed the 2nd output example.
Line 1,765: Line 1,765:
===VAX FORTRAN===
===VAX FORTRAN===
<lang Fortran>
<lang Fortran>
PROGRAM TIMES
PROGRAM TABLES
IMPLICIT NONE
IMPLICIT NONE
C
C
Line 1,790: Line 1,790:
END
END
</lang>Based on the above code but with a slight modification as VAX FORTRAN doesn't allow zero width fields in a format statement. The number of rows and columns can also be altered by modifying the value of K which must be in the range 1 - 25.
</lang>Based on the above code but with a slight modification as VAX FORTRAN doesn't allow zero width fields in a format statement. The number of rows and columns can also be altered by modifying the value of K which must be in the range 1 - 25.
===Microsoft FORTRAN-80===
<lang Fortran> PROGRAM TABLES
C
C Produce a formatted multiplication table of the kind memorised by rote
C when in primary school. Only print the top half triangle of products.
C
C 24 Nov 15 - 0.2 - Adapted from original for Microsoft
C FORTRAN-80 - MEJT
C
DIMENSION K(12)
DIMENSION A(6)
DIMENSION L(12)
C
COMMON //A
EQUIVALENCE (A(1),L(1))
C
DATA A/'(1H ',',I2,','1H|,','01X,','I3,1','2I4)'/
C
C Print a heading and (try to) underline it.
C
WRITE(1,1) (I,I=1,12)
1 FORMAT(4H0 |,12I4,/,4H --+12(4H----))
C
C Overlaying the format specifier with an integer array makes it possibe
C to modify the number of blank spaces. The number of blank spaces is
C stored as two consecuitive ASCII characters that overlay on the
C integer value in L(7) in the ordr low byte, high byte.
C
DO 3 I=1,12
L(7)=(48+(I*4-3)-((I*4-3)/10)*10)*256+48+((I*4-3)/10)
DO 2 J=1,12
K(J)=I*J
2 CONTINUE
WRITE(1,A)I,(K(J), J = I,12)
3 CONTINUE
C
END</lang>Rather more changes are needed to produce the same result using the Microsoft FORTRAN-80 compiler, in particular we cannot modify the format specifier directly and have to rely on overlaying it with an integer array and calculating the ASCII values needed for each byte in the string we need to modify.

=={{header|Go}}==
=={{header|Go}}==
<lang go>
<lang go>