    Program s21bcfe

!     S21BCF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, s21bcf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: rd, x, y, z
      Integer                          :: ifail, ix, iy
!     .. Intrinsic Procedures ..
      Intrinsic                        :: real
!     .. Executable Statements ..
      Write (nout,*) 'S21BCF Example Program Results'

      Write (nout,*)
      Write (nout,*) '    X      Y      Z        S21BCF'
      Write (nout,*)

data: Do ix = 1, 3
        x = real(ix,kind=nag_wp)*0.5E0_nag_wp

        Do iy = ix, 3
          y = real(iy,kind=nag_wp)*0.5E0_nag_wp
          z = 1.0E0_nag_wp

          ifail = -1
          rd = s21bcf(x,y,z,ifail)

          If (ifail<0) Then
            Exit data
          End If

          Write (nout,99999) x, y, z, rd
        End Do

      End Do data

99999 Format (1X,3F7.2,F12.4)
    End Program s21bcfe
