    Program c02ahfe

!     C02AHF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. Use Statements ..
      Use nag_library, Only: c02ahf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: ai, ar, bi, br, ci, cr
      Integer                          :: ifail
!     .. Local Arrays ..
      Real (Kind=nag_wp)               :: zlg(2), zsm(2)
!     .. Executable Statements ..
      Write (nout,*) 'C02AHF Example Program Results'

!     Skip heading in data file
      Read (nin,*)

      Read (nin,*) ar, ai, br, bi, cr, ci

      ifail = -1
      Call c02ahf(ar,ai,br,bi,cr,ci,zsm,zlg,ifail)

      If (ifail==0) Then
        Write (nout,*)
        Write (nout,*) 'Roots of quadratic equation'
        Write (nout,*)
        Write (nout,99999) 'z = ', zsm(1), zsm(2), '*i'
        Write (nout,99999) 'z = ', zlg(1), zlg(2), '*i'
      End If

99999 Format (1X,A,1P,E12.4,Sp,E14.4,A)
    End Program c02ahfe
