Hello I was wondering if anyone could help me with this programming assignment i
ID: 3780914 • Letter: H
Question
Hello I was wondering if anyone could help me with this programming assignment in C++. Thanks in advance! : Write a C++ program that inputs the radius of a circle and then computes the area and circumference of the circle using the following formulae: area = pi * radius * radius circumference = 2 * pi * radius. Set pi to 3.14159. Note that the C++ "^" operator is not an exponentiation operator. The program input/output should look like the following: Enter the radius (in inches): 10.0 Area of a circle with this radius = 314.16 square inches Circumference of a circle with this radius = 62.83 inches
Explanation / Answer
# include < iostream >
using namespace std;
void main ( )
{
double pi , radius , area , circumference ;
pi = 3.14592653589793238462643383279502884197169399375;
cout << " please input the value of radius : " ;
cin >> radius ;
area = pi * ( radius * radius ) ;
circumference = 23 * pi * radius ;
cout << " the area of the circle is " << area << " and the circumference is "
<< circumference << ' . ' << end1 ;
system ( " pause " ) ;
}
output -
please input the value of radius : 2
the area of the circle is 12.5664 and the circumference is 144.513.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.