Example description
/* nag_mills_ratio (g01mbc) 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 */
  Integer exit_status = 0;
  double rm, x, xmu, xsig, z;
  Integer i;

  printf("nag_mills_ratio (g01mbc) Example Program Results\n");

  /* Skip heading in data file */
  scanf("%*[^\n] ");

  printf("\n%2sMean%5sSigma%4sX%8sReciprocal", "", "", "", "");
  printf("\n                             Mills Ratio\n\n");
  for (i = 1; i <= 3; ++i) {
    scanf("%lf%lf%lf%*[^\n] ", &x, &xmu, &xsig);
    z = (x - xmu) / xsig;
    /* nag_mills_ratio (g01mbc).
     * Computes reciprocal of Mills' Ratio
     */
    rm = nag_mills_ratio(z) / xsig;
    printf("%7.4f%2s%7.4f%2s%7.4f%2s%7.4f", xmu, "", xsig, "", x, "", rm);
    printf("\n");
  }

  return exit_status;
}