      module sides
      real :: a,b,c
c
c    a & b- length of the sides adjacent to the right angle
c    c    - length of the hypotenuse
c
      end module 
c
      program hypot
c
      implicit none
c
c   Calculate the length of the hypotenuse of a right triangle
c   given the length of the other two size.
c
c   Programmed by: John Mahaffy  1/2/97
c
      call input
c
      call pythag
c
      call output
      stop
      end
c
      subroutine pythag
      use sides
      implicit none
c
c   Apply the Pythagorean Theorem to obtain the length
c   of the hypotenuse
c
c   Programmed by: John Mahaffy  1/2/97
c   Modified by:
c
c---------------------------------------------------------
      c = sqrt ( a**2 + b**2)
c---------------------------------------------------------
      return
      end
c
      subroutine input 
      use sides
      implicit none
c
c   Prompt for and read the two sides of the triangle
c   adjacent to the right angle
c
c   Programmed by: John Mahaffy  1/2/97
c
      write(*,2000)
 2000 format(' Type in the length of the sides adjacent',
     & ' to the right angle.')
      read *, a, b
      return
      end
c
      subroutine output
      use sides
      implicit none
c
c   Print the lengths of the three sides of the triangle
c
c   Programmed by: John Mahaffy  1/2/97
c
      write  (*,2000) a,b,c
 2000 format (' Length of the sides (c is the hypotenuse)',
     &  /,'   a = ',f9.2,
     &  /,'   b = ',f9.2,
     &  /,'   c = ',f9.2)
      return
      end
