    PROGRAM c02alfe

!      C02ALF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : c02alf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: a, b, c, d, e
       INTEGER                         :: i, ifail
!      .. Local Arrays ..
       REAL (KIND=nag_wp)              :: errest(4), zeroi(4), zeror(4)
!      .. Executable Statements ..
       WRITE (nout,*) 'C02ALF Example Program Results'

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

       READ (nin,*) e, a, b, c, d

       ifail = 0
       CALL c02alf(e,a,b,c,d,zeror,zeroi,errest,ifail)

       WRITE (nout,*)
       WRITE (nout,*) ' Roots of quartic equation   ', &
          '        Error estimates'
       WRITE (nout,*) '                             ', &
          '      (machine-dependent)'
       WRITE (nout,*)

       DO i = 1, 4
          WRITE (nout,99999) ' z = ', zeror(i), zeroi(i), '*i', errest(i)
       END DO

99999  FORMAT (1X,A,1P,E12.4,SP,E12.4,A,8X,SS,E9.1)
    END PROGRAM c02alfe
