Answer to Question #265717 in C for nick

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.


1
Expert's answer
2021-11-13T23:52:37-0500
#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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS