next up previous contents
Next: Free vs. Fixed Formats Up: A quick tour of Previous: A quick tour of   Contents

Program Form

The main program unit begins with the keyword program (optional), followed by the program name (also otional); it ends with the keyword end (required), followed by program Name_Prog (optional).

        program <name>
            declarations
            executable code
        end [ program <name> ]

Open a file hello.f90. Type the following ``hello world'' program:

! my first Fortran program
program hello
  print*, 'Hello World!'
end program hello

Compile it with f90 hello.f90. Run the resulting code with a.out.



Adrian Sandu 2001-08-26