Start with a copy of program chapter1_1.c shown on pages 18 and 25-26 (use the Copy button at bottom of VECR) which computes the distance between two points.
Assume now that x1,y1 represent the coordinates of the center of a circle, and x2,y2 represent a point on the circumference of the circle.
Modify the program so instead of computing the distance, it computes and displays the area of the circle.
double area
; for the area computation.
4*atan(1)
.
atan() is the arctangent function, which gives the angle, in radians,
associated with a tangent value; the angle whose tangent is 1 is
π/4 in radians (45 degrees), so 4*atan(1)
is π.
printf("x1 = %g\n",x1);
NOT: printf("x1=1\n");
.