NAG Library Manual, Mark 30.1
Interfaces:  FL   CL   CPP   AD 

NAG CL Interface Introduction
Example description
/* nag_stat_prob_studentized_range (g01emc) Example Program.
 *
 * Copyright 2024 Numerical Algorithms Group.
 *
 * Mark 30.1, 2024.
 */

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

int main(void) {
  /* Scalars */
  Integer exit_status = 0;
  double q, v, valp;
  Integer i, ir;
  NagError fail;

  INIT_FAIL(fail);

  printf("nag_stat_prob_studentized_range (g01emc) Example Program Results\n");

  /* Skip heading in data file */
  scanf("%*[^\n] ");
  printf("\n%s\n\n", "  q       v    ir    Quantile ");
  for (i = 1; i <= 3; ++i) {
    scanf("%lf%lf%" NAG_IFMT "%*[^\n] ", &q, &v, &ir);
    /* nag_stat_prob_studentized_range (g01emc).
     * Computes probability for the Studentized range statistic
     */
    valp = nag_stat_prob_studentized_range(q, v, ir, &fail);
    if (fail.code != NE_NOERROR) {
      printf("Error from nag_stat_prob_studentized_range (g01emc).\n%s\n",
             fail.message);
      exit_status = 1;
      goto END;
    }
    printf("%7.4f%2s%4.1f%1s%3" NAG_IFMT "%1s%10.4f\n", q, "", v, "", ir, "",
           valp);
  }

END:
  return exit_status;
}