The next simplest Fortran program is something programmers call the "Hello World" program. This is the simplest program that actually produces some output. An example of the "Hello World" program in Fortran is:
PROGRAM MAIN PRINT *, 'HELLO WORLD' STOP END
The PRINT statement writes output to the screen when the program is run interactively. (In fact it writes to something called "standard output," which defaults to the screen.) The asterisk in the PRINT statment specifies "free format" output. This essentially means that we aren't interested in the exact format in which the system prints the result. The text you want to print out is inside single quotes.
Assignment:
(1) Type the "Hello World" program. Compile it and run it.
(2) Change the "Hello World" program to print out something else, such as your name.
Back to main page for programming tutorial