PROGRAM s21ccfe

!      S21CCF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : nag_wp, s21ccf
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: q, x, y
       INTEGER                         :: ifail, k
!      .. Executable Statements ..
       WRITE (nout,*) 'S21CCF Example Program Results'

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

       WRITE (nout,*)
       WRITE (nout,*) ' K    X     Q         Y'
       WRITE (nout,*)

       READ (nin,*) k, x, q

       ifail = -1
       y = s21ccf(k,x,q,ifail)

       IF (ifail>=0) THEN
          WRITE (nout,99999) k, x, q, y
       END IF

99999  FORMAT (1X,I2,2X,F4.1,2X,F4.1,2X,1P,E12.4)
    END PROGRAM s21ccfe