program ch1200a implicit none integer , parameter :: nrow=5 integer , parameter :: ncol=6 integer:: cmark, student real:: mark, minmark real , dimension(1:nrow,1:ncol):: exam_results = 0.0 character(len=40):: fname ! ! demonstrating the use of array intrinsic functions ! integer :: r print *,'name of exam results data file?' read '(A)',fname open(unit=1,file=fname,status='old') do r=1,nrow read(1,*) exam_results(r,1:ncol) end do ! scale 3rd column exam_results(1:nrow,3) = 2.5 * exam_results(1:nrow,3) ! ! print out updated marks do r=1,nrow write(*,100) exam_results(r,1:ncol) 100 format(6(f4.0,2x)) end do ! exam mark to test for print *,'enter exam mark you are searching for' read *,mark if (all(exam_results >= mark)) then write(*,200)mark 200 format('all results are >= ',f5.1) else if (any(exam_results >= mark)) then cmark=count(exam_results >= mark) write(*, 300)cmark,mark 300 format(i3,' results are >= ',f5.1) endif endif ! ! find minimum mark for a particular student (row) ! print*,'enter student number to search for minimum mark' read*,student minmark = minval(exam_results(student,1:ncol)) write(*,400)student,minmark 400 format('for student ',i2,' minimum mark is ',f5.1) end program ch1200a