/* nag_elliptic_integral_complete_K (s21bhc) Example Program.
 *
 * Copyright 2017 Numerical Algorithms Group.
 *
 * Mark 26.1, 2017.
 */
/* Pre-processor includes */
#include <stdio.h>
#include <nag.h>
#include <nag_stdlib.h>
#include <nags.h>

int main(void)
{
  /*Integer scalar and array declarations */
  Integer exit_status = 0;
  Integer ix;
  /*Double scalar and array declarations */
  double dm, k;
  NagError fail;

  INIT_FAIL(fail);

  printf("%s\n",
         "nag_elliptic_integral_complete_K (s21bhc) Example Program Results");
  printf("\n    dm       nag_elliptic_integral_complete_K\n\n");
  for (ix = 1; ix <= 3; ix++) {
    dm = ix * 0.250e0;
    /*
     * nag_elliptic_integral_complete_K (s21bhc)
     * Complete elliptic integral of 1st kind, Legendre form, K(m)
     */
    k = nag_elliptic_integral_complete_K(dm, &fail);
    if (fail.code != NE_NOERROR) {
      printf("Error from "
             "nag_elliptic_integral_complete_K (s21bhc).\n%s\n",
             fail.message);
      exit_status = 1;
      goto END;
    }
    printf("%7.2f%12.4f\n", dm, k);
  }

END:

  return exit_status;
}