PROGRAM TwoFunctions
   IMPLICIT NONE
   INTEGER :: A, B, BiggerOne
   REAL    :: Ave

   READ(*,*) A, B

   BiggerOne = Large(A, B)
   Ave = Average(A, B)

   WRITE(*,*) 'Bigger one is ', BiggerOne
   WRITE(*,*) 'Average is ' , Ave

CONTAINS

   INTEGER FUNCTION Large (Num1, Num2 )
      IMPLICIT NONE
      INTEGER, INTENT(IN) :: Num1, Num2
     
      IF ( Num1 > Num2 ) THEN
          Large = A
      ELSE
          Large = B
      END IF

   END FUNCTION Large

   REAL FUNCTION Average(Val1, Val2)
      IMPLICIT NONE
      INTEGER, INTENT(IN) :: Val1, Val2

      Average = ( Val1 + Val2 ) / 2.0
  
   END FUNCTION Average

END PROGRAM TwoFunctions    
   
