#include <stdio.h>
#define PI 3.1416
int
main (void)
{
double diam, area, circ, r;
FILE *in, *out;
in = fopen ("diameter.data", "r");
out = fopen ("report_circle.txt", "w");
printf ("Reading data from file... ");
fscanf (in, "%lf", &diam);
printf ("Value read: %lf\n\n", diam);
r = diam / 2;
area = PI * r * r;
circ = 2 * PI * r;
fprintf (out, "%4.2lf %4.2lf\n", area, circ);
printf ("Sending results to file report_circle.txt...\n\n");
fclose (in);
fclose (out);
printf ("Program completed.");
return (0);
}