Problem 2: You need to create a quick tool for computing the area and the circum
ID: 3619968 • Letter: P
Question
Problem 2: You need to create a quick tool for computing the area and the circumference of a circle. Write a Cprogram that
(a) Prompts the user to enter the radius of the circle. A real number is expected.
(b) Prints on the screen the circumference of the circle in the following format: “The circumference of a circle with
radius x ft is equal to x.xx ft.”
(c) Prints on the screen the area of the circle in the following format: “The area of a circle with radius x ft is equal
to x.xx sq. ft.”
The results should be printed to a precision of 2 decimal digits.
Explanation / Answer
#include main() { float c,a,r; // varible declaration prinf("Enter radius of the circle:"); // getting input scanf("%d",&r); c=2*3.148*r; // calculate circumference of circle with formula c=2*pi*r a=3.14*r*r; // calculate area of circle with formula A=pi*r*r //Display the output prinf("The circumference of a circle with radius %d",r "ft is equal to %d",c "ft.Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.