C This program prompts the user for the name of a data file which C contains coordinates for points in a Cartesian plane. The program C reads all the points in the file and then prints average distance C of the points from the origin as well as the total number C of points read from the file. C C The points are only specified with four digits of precision and C are all less than ten units away from the origin. The data is C stored without the decimal point and there isn't necessarily a C space between the numbers so that the data can be correctly read C with a 2F5.3 format descriptor. C C John Schneider C CptS 203, HW 5, problem 2 C-------------------------------------------------------------------------- program dstavg implicit none real x, y, sum integer count character filnam*50 count = 0 sum = 0.0 print *, 'Enter the input file name.' read '(a)', filnam open(unit=27,file=filnam,status='old') 10 continue read(27,'(2f5.3)',end=20)x,y sum = sum + sqrt(x*x + y*y) count = count + 1 goto 10 20 continue print *, 'There were ',count,' entries in the file.' print *, 'The average distance is ',sum/count,'.' stop end