C
C  program 14
C  CWJ SDSU 2/7/05
C
C  illustrates subroutine calls
C

      program program14
C
C this is the main calling program
C

      implicit none

      integer i
      real x,y

      print*,' enter an integer '
      read*,i

      call printinteger(i)

      print*,' enter a real number  '

      read*,x

      call multiplyxby2(x,y)
   
      call printreal(y)

      print*, ' Finished calling subroutines ' 
      end

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCcc
C
C  subroutine printinteger
C
C  prints out an integer
C
C  INPUT: 
C    integer n
C
C  OUTPUT:
C    none
C

      subroutine printinteger(n)

      implicit none

      integer n

      print*,n
      return
      end

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
C  subroutine multiplyxby2
C
C  reads in a real number and multiplies by 2
C
C  INPUT:
C    x  
C
C  OUTPUT
C    y
C
C
      subroutine multiplyxby2(x,y)

      implicit none
      real x,y

      y=x*2.0
      return
      end

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
C subroutine printreal
C
C  prints a real number
C
C  INPUT:
C    x
C
C  OUTPUT:
C    none (prints to screen)
C
C
      subroutine printreal(z)

      implicit none
      real z
      
      print*,z

C note: no RETURN statement
      stop
      end      

