MODULE quad_mod


CONTAINS


! -----------------------------------------------------------------------------
! -- 

SUBROUTINE Get_Coefficients(a, b, c)

  IMPLICIT NONE
  REAL, INTENT(INOUT) :: a, b, c

  PRINT *, "Enter coefficients:"
  READ  *, a, b, c
  PRINT *, "Got coefficients:", a, b, c

END SUBROUTINE


! -----------------------------------------------------------------------------
! -- 

SUBROUTINE Compute_Roots(a, b, c, r_1, r_2)

  IMPLICIT NONE
  REAL, INTENT(IN)     :: a, b, c
  COMPLEX, INTENT(OUT) :: r_1, r_2

    PRINT *, "Computing roots..."

    r_1 = (-b + SQRT(CMPLX(b**2 - 4*a*c))) / (2*a)
    r_2 = (-b - SQRT(CMPLX(b**2 - 4*a*c))) / (2*a)

END SUBROUTINE


! -----------------------------------------------------------------------------
! -- 

SUBROUTINE Put_Roots(r_1, r_2)

  IMPLICIT NONE
  COMPLEX, INTENT(IN) :: r_1, r_2

    PRINT *, "The roots are..."
    PRINT *, r_1, r_2
END SUBROUTINE


! -----------------------------------------------------------------------------
END 
! -----------------------------------------------------------------------------

