/* Problem 5--The Knights of the Round Circle
   This problem became trivial if you observed that the average number
   replaced is equal to 1/2 + 1/3 + 1/4 + ... + 1/n . */

#include <stdio.h>
#include <stdlib.h>

FILE *in, *out;

int main (int argc, char **argv);

int main (int argc, char **argv) {

  int sz, i;
  double sum;

 in = fopen ("prob5.in","r");
 out = fopen ("prob5.out","w");
 while (fscanf(in,"%d",&sz),sz>0) {
  sum = 0;
  for (i=2;i<=sz;i++) sum += 1.0/i; /* Just run the loop */
  fprintf (out,"With %d competitors, "
    "a Jedi Knight will be replaced approximately %.2f times.\n\n",
           sz,sum);
 }
 fclose (in);
 fclose (out);
 return EXIT_SUCCESS;
}
