P51.F90

Reading data into arrays


!
! =====> Program - P51.F90
!
      CHARACTER(LEN=3) :: MONTH(12)
      INTEGER  UNITS(12)
      REAL     SALES(12)
!
!
      PRINT *, 'This is Program >> P51  - Read data into arrays'
!
!     Tell program where data for  READ   is coming from
      OPEN(UNIT=5, FILE='P51.DAT')      ! UNIT=5 is the default input
!
!
      READ 10,MONTH
      READ 20,UNITS
      READ 30,SALES
10    FORMAT(12A3)
20    FORMAT(12I5)
30    FORMAT(12F5.0)
      STOP
      END

DATA:
JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC
  672  609  715  803  810  831  829  727  780  703  791  783
  3.4  3.2  3.7  4.2  4.8  5.1  5.1  5.1  4.3  3.9  4.2  3.6

OUTPUT:
Program entered
 This is Program >> P51  - Read data into arrays
Fortran-90 STOP

Come back to the previous page

Page builder: Charles Boivin

Last modified: 11/07/95