Skip to main content

15.4) Preparing To Run A Program


First we have to get a program running. Since this training assumes you don’t yet know how to program, I will show you how to make a simple program that we can analyse with top. Just follow the instructions below.

First, open a new file in emacs and call it ‘runit.f95’. All files that you intend to be programs in Fortran 95 must have a filename that ends with '.f95'. (Note: This is for the version of Fortran called Fortran95.) There are similar conventions for other programming languages - e.g. in C, files end with '.c'.

In the file enter the following exactly what appears below:

program runit
j=1
i=2
do while (i > j)
   print *, 'program is running and cannot stop'
enddo
end program runit