Example description
/* nag_prob_2_sample_ks (g01ezc) Example Program.
 *
 * Copyright 2017 Numerical Algorithms Group.
 *
 * Mark 26.2, 2017.
 */

#include <stdio.h>
#include <nag.h>
#include <nag_stdlib.h>
#include <nagg01.h>

int main(void)
{

  /* Scalars */
  double d__, prob;
  Integer exit_status, n1, n2;
  NagError fail;

  INIT_FAIL(fail);

  exit_status = 0;
  printf("nag_prob_2_sample_ks (g01ezc) Example Program Results\n\n");
  printf("    d      n1    n2    Two-sided probability\n\n");

  /* Skip heading in data file */
  scanf("%*[^\n] ");
  while (scanf("%" NAG_IFMT "%" NAG_IFMT "%lf%*[^\n] ", &n1, &n2, &d__) !=
         EOF)
  {
    /* nag_prob_2_sample_ks (g01ezc).
     * Computes probabilities for the two-sample
     * Kolmogorov-Smirnov distribution
     */
    prob = nag_prob_2_sample_ks(n1, n2, d__, &fail);
    if (fail.code != NE_NOERROR) {
      printf("Error from nag_prob_2_sample_ks (g01ezc).\n%s\n", fail.message);
      exit_status = 1;
      goto END;
    }
    printf("%7.4f%2s%4" NAG_IFMT "%2s%4" NAG_IFMT "%10s%7.4f\n", d__,
           "", n1, "", n2, "", prob);
  }
END:
  return exit_status;
}