Skip to main content

6.14) Exercise 4


  1. You measure the temperature in five different rooms and you get the following values 22.3, 19.1, 24.5, 31.2, and 18.4. The first part of the task is to enter these values into a datafile called temp.dat using either emacs or vi.
  2. Write a fortran95 code that reads the five temperature values from the data file into an array (so you get experience with arrays) and computes the average temperature value. This average temperature value should then be written out to a file called outtemp.dat. (Note, the average is just the sum of the five values divided by 5).