/* program to convert two temperatures in fahrenheit and their average
   to temperatures in celsius */

#include <stdio.h>

int main ()
{
  /* declare variables */
  double fahr1, fahr2; // two fahrenheit numbers will allow decimal points
  double cel1, cel2;   // celsius temperatures also will be real numbers

  /* initialization */
  fahr1 =  86.1;
  fahr2 = 111.1;

  /* compute celsius equivalents */  
  cel1 = (fahr1 - 32.0) * 5.0 / 9.0;
  cel2 = (fahr2 - 32.0) * 5.0 / 9.0;

  /* computer average values */
  double sum = fahr1 + fahr2;  /* average computation split into
                                  two steps for variety */
  double fahravg = sum / 2.0;
  double celavg = (fahravg - 32.0) * 5.0 / 9.0;
  
  /* print table of results */

  printf ("                 Fahrenheit  Celsius\n");  //table title
  /* report results to 1 decimal place */
  printf ("Temperature 1:   %7.1lf %10.1lf\n", fahr1, cel1);
  printf ("Temperature 2:   %7.1lf %10.1lf\n", fahr2, cel2);
  printf ("      Average:   %7.1lf %10.1lf\n", fahravg, celavg);
  
  /* tell operating system "no errors" */
  return 0;
}
