I need to Write a program to calculate the circumference and area of multiple ci
ID: 3811068 • Letter: I
Question
I need to Write a program to calculate the circumference and area of multiple circles given the radius of each.
Your solution must include two functions: one to compute the circumference and one to compute the area. Each function must be called from your main function for each circle, and it needs to return the value back to the main function.
Your main function needs to ask the user to enter the number of circles. Then it needs to obtain the radius value for each circle in order to compute the values needed.
The output must be displayed to three decimal point accuracy using string formatting. They need to be lined up in a nicely formed table with an appropriate heading. The table must include the radius value input by the user in the first column.
All input/output must be done in your main function.
Explanation / Answer
#include <stdio.h>
#include <conio.h>
const float PI = 3.1415927;
float area(float radius);
float circum(float radius);
void main()
{
float radius;
printf("Enter radius: ");
scanf("%f", &radius);
printf("Area : %f ", area(radius));
printf("Circumference: %f ", circum(radius));
getch();
}
float area(float radius)
{
return PI * radius * radius;
}
float circum(float radius)
{
return 2 * PI * radius;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.