Link: Mitch Richling's Home Page

© 2009 Mitch Richling

Example Fortran Programs

Here you will find several small, but complete, FORTRAN 77 programs illustrating many common language concepts and constructs. The intent of this page is to give programmers with no FORTRAN 77 xperience, a core of fundamental examples to help them get up to speed quickly on this venerable language. My advice for the fist time FORTRAN programmer is to give this language a chance and have so me fun with it! If you really want to become an expert FORTRAN programmer, then the best way is to look at quality code -- check out the BLAS and LAPACK for a start. Good luck. The makefile is here.

Variable Declarations & Types

types.f
How to explicitly declare various variable types
implv.f
How to use the rather dubious implicit variable type features of FORTRAN
implml.f
Demonstrates the "IMPLICIT NONE" statement specified in MIL-STD-1753

Various "Variable" Topics

array.f
How to declare and use arrays
arrsub.f
Arrays and subroutines
parm.f
Parameter "variables"
datas.f
The "data" statement used to initialize variables.
coms.f
Common blocks
chars.f
Character "strings"

I/O

io.f
Simple console I/O
fileio.f
Simple file I/O
fmtio.f
Formatted I/O
intFil.f
How to use "Internal Files"

Subroutines & Functions

statf.f
One line functions
func.f
Regular functions
subs.f
Subroutines
savey.f
Demonstrates the SAVE statement

Arithmetic

arith.f
Illustrates some arithmetic concepts in FORTRAN

Loops

do.f
The FORTRAN 77 do loop
loopsg.f
FORTRAN 77 looping constructs
loop90.f
Fortran90 style loops (commonly implemented in FORTRAN 77 compilers)
goto.f
Simple GOTO -- infinite loop
loopml.f
Nonstandard, but common, loop construct specified in MIL-STD-1753

Control Structures

ifth.f
If-Then and all of its little buddies!

Hello World!

hello.f
A simple hello world program!
© 2009 Mitch Richling