P63.F90

Multiple subroutine calls


!
! =====> Program - P63.F90
!
!     Multiple CALLs to a SUBROUTINE
!
!
      PRINT *, 'This is Program >> P63  - Multiple subroutine CALLs'
!
!
!     Tell program where data for  READ *  is coming from
      OPEN(UNIT=5, FILE='P63.DAT')      ! UNIT=5 is the default input
!
      READ *,I,J
      PRINT *,I,J
      CALL SWAP(I,J)
      PRINT *,I,J
      PRINT *         ! Leave a blank line
      READ *,M,N
      PRINT *,M,N
      CALL SWAP(M,N)
      PRINT *,M,N
      PRINT *         ! Leave a blank line
      CALL SWAP(I,J)
      PRINT *,I,J
      STOP
      END
!
      SUBROUTINE SWAP(I,J)
!     This routine interchanges 2 INTEGERs
      K=I
      I=J
      J=K
      RETURN
      END

DATA:
10 27
15 43

OUTPUT:
Program entered
 This is Program >> P63  - Multiple subroutine CALLs
 10 27
 27 10

 15 43
 43 15

 10 27
Fortran-90 STOP

Come back to the previous page

Page builder: Charles Boivin

Last modified: 11/07/95