#include <stdio.h>
#include <math.h>
#define PI 3.1415926
/* Computes the circumference of a circle with radius r */
/* r is defined and is > 0 */
/* PI is a constant macro representing an approximation of pi */
double
find_circum(double r)
{
return (2.0 * PI * r);
}
/* Computes the area of a circle with radius r */
double
find_area(double r)
{
return (PI * pow(r, 2));
}
int
main (void)
{
/* declarations */
double diam, area, circ, r;
/* get diameter from user */
printf ("Enter a value for the diameter: ");
scanf ("%lf", &diam);
/* do the computations by calling the functions */
r = diam / 2;
area = find_area (r);
circ = find_circum (r);
/* display the report on the screen */
printf ("\nA circle with a diameter of %3.1lf cm, ", diam);
printf ("has an area of %5.3lf cm2\n", area);
printf ("and a circumference of %4.2lf cm.\n", circ);
return (0);
}