    PROGRAM c02ahfe

!      C02AHF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. 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
