PROGRAM Exam2 IMPLICIT NONE CHARACTER(LEN=20) :: name REAL :: mark1, mark2, mark3, mark4 INTEGER :: error=0 OPEN(UNIT=4,FILE='MARKS.DAT') DO READ(UNIT=4,FMT=*, IOSTAT=error) name, mark1, mark2, mark3, mark4 IF (error < 0) EXIT ! end of file test average = (mark1 + mark2 + mark3 + mark4)/4.0 WRITE(*,*) name, average END DO CLOSE (UNIT=4) END PROGRAM