Linux Know-How provides a collection of introductory texts on often needed Linux skills.


FORTRAN

g77

GNU FORTRAN. An on-line manual is available at: http://gcc.gnu.org/onlinedocs/g77/. If you are really into FORTRAN, you might also want to check: http://studbolt.physast.uga.edu/templon/fortran.html to find a FORTRAN compiler that suits your particular needs under Linux.

Silly example of a Fortran code. It prints squares and cubes of numbers from 1 to 20:

PROGRAM TRY_FORTRAN

INTEGER X

PRINT 200, "X", "X^2", "X^3"

DO X=1, 20

PRINT 100, X, X**2, X**3

END DO

100 FORMAT (I20, I20, I20)

200 FORMAT (A20, A20, A20)

END

To compile this file, I run the fortran compiler with the option that recognizes the "free-form" source code (I don't like the fixed-code source):

g77 -ffree-form try_fortran.f

and now I can run the resulting executable (which has the default name is a.out):

./a.out


Last Update: 2010-12-16