! This is a basic starting shell for your programs MODULE const INTEGER, PARAMETER :: dp = KIND(1.0d0), sp = KIND(1.0e0) REAL(KIND=dp), PARAMETER :: dpi = 3.141592653589793d0 END MODULE const ! PROGRAM prog USE const IMPLICIT NONE ! ! HW 16, P1 ! INTEGER :: n,flag1,flag2,flag3,rvalue ! The flag variables are indicators ! ! flag1 /= 0 => first value > 100 has been found ! flag2 /= 0 => first value < -10 has been found ! flag3 /= 0 => first value = 0 has been found ! flag1 = 0 flag2 = 0 flag3 = 0 n = 0 DO READ(*,*,END=100) rvalue n = n + 1 IF((rvalue > 100).AND.(flag1 == 0)) THEN flag1 = n ENDIF IF((rvalue < -10).AND.(flag2 == 0)) THEN flag2 = n ENDIF IF((rvalue == 0).AND.(flag3 == 0)) THEN flag3 = n ENDIF ENDDO 100 CONTINUE WRITE(*,*) 'n = ',n WRITE(*,*) 'First value > 100 = ',flag1 WRITE(*,*) 'First value < -10 = ',flag2 WRITE(*,*) 'First 0 = ',flag3 END PROGRAM prog !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! n = 17834 ! First value > 100 = 3427 ! First value < -10 = 7953 ! First 0 = 10124