P31.F90

Logical Relations


!
! =====> Program - P31.F90
!
!
!     Example to show use of logical variables
!
      INTEGER WEIGHT, AGE
      LOGICAL HEAVY,MINOR
!
!
      PRINT *, 'This is Program >> P31  - Logical Relations'
!
!
!     Tell program where data for  READ *  is coming from
      OPEN(UNIT=5, FILE='P31.DAT')      ! UNIT=5 is the default input
!
      READ * ,WEIGHT,AGE
      HEAVY=WEIGHT > 90
      MINOR=AGE <  18
      PRINT *,WEIGHT,HEAVY
      PRINT *,AGE,MINOR
      STOP
      END

DATA:
65 17

OUTPUT:
Program entered
 This is Program >> P31  - Logical Relations
 65 F
 17 T
Fortran-90 STOP

Come back to the previous page

Page builder: Charles Boivin

Last modified: 11/07/95