• 100% Satisfaction Guarantee

HW Helper, Tutor
Category: Homework
Satisfied Customers: 45
Experience:  B.A. from top 20 business school-actually misses doing homework-math, econ, psych, business, art
6422916
HW Helper is online now

# Write a program to calculate the area of a circle. The equation

### Customer Question

Write a program to calculate the area of a circle. The equation to determine the area of a circle is area = 3.1416*radius*radius. Assume that the circle has a radius of 4 inches.

Rewrite the above program so that the program accepts any value for the radius then recalculate the area of the circle.
Submitted: 7 years ago.
Category: Homework
Expert:  HW Helper replied 7 years ago.
Wesley,

What kind of program are you looking for? A simple if, then program for a graphing calculator say, or some kind of a computer program?

Look forward to helping you
Customer: replied 7 years ago.
Just the calculation of the circle using the information that was given.
Expert:  HW Helper replied 7 years ago.
Wesley,

Circle Area Program if I wrote it for my calculator:

query R, R > 0

Y = R*R*3.1416

display "the area of the circle with radius"
display R
display "is"
display Y

----------

If you need something more simple:

Find R, where R > 0
R*R*3.1416 = Y
The area of the circle with radius R is Y

With your example of 4 inches:

query R
R = 4
4*4*3.1416 = Y
Y = 50.2656

The area of a circle with radius R inches is Y inches squared.
The area of a circle with radius 4 inches is 50.2656 inches squared.
HW Helper, Tutor
Category: Homework
Satisfied Customers: 45
Experience: B.A. from top 20 business school-actually misses doing homework-math, econ, psych, business, art
Customer: replied 7 years ago.
I actually wanted to see what it would look like in the program format so that if I run the program i would be able to see the results
Expert:  HW Helper replied 7 years ago.
Which format are you looking for?
Customer: replied 7 years ago.
Ok, with the question that I asked, how would it appear in a program format starting from
*/
#include <iostream>
using namespace std;
int main()
{
with these included, how would the progam look.
Expert:  HW Helper replied 7 years ago.
Ok, this is C++, which I took in college.
<br />
<br />
<br />*/
<br />
<br />#include <iostream>
<br />
<br />using namespace std;
<br />
<br />const float PI=3.14159;
<br />
<br />int main ()
<br />{
<br />float area;
<br />
<br />
<br />cout << A circle of radius 4 has an area of: " <<area<<endl;
<br />
<br />return 0;
<br />}
<br />
<br />
<br />If you wanted to find the area yourself you can use:
<br />
<br />{
<br />}
<br />
HW Helper, Tutor
Category: Homework
Satisfied Customers: 45
Experience: B.A. from top 20 business school-actually misses doing homework-math, econ, psych, business, art
Expert:  HW Helper replied 7 years ago.
sorry noticed a typo!

In the cout statement section, it should have " at the end of the area display function.

Or:
cout << A circle of radius 4 has an area of: "<<area<<"endl;

Customer: replied 7 years ago.
I entered it into a Dev-C++ program but can't get the answer you gave me, i am getting a lot of errors.
Expert:  Raj replied 7 years ago.
So you need the code for this??
Expert:  Raj replied 7 years ago.