Question #265717

 The initial value of the radius of a circle is equal to one unit and each succeeding radius is one unit greater than the value before it. Write a program that computes the area of the circle starting with r = 1.0 to r = 5.0. Print out each radius and the corresponding area of the circle.


Expert's answer

#include <stdio.h>

#define PI 3.14159265f

int main() {
  float r = 1.0;
  while (r <= 5.0) {
    printf("r: %f, area: %f\n", r, PI * r * r);
    r += 1.0;
  }
  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS