Answer to Question #266265 in C++ for Wendy

Question #266265

Create C++ full program that calculates Surface Area of a Sphere, knowing that the

Surface Area of a Sphere = 4 pi r2 (where r is radius of circle) and PI = 3.14.


1
Expert's answer
2021-11-15T07:37:11-0500


SOLUTION TO THE ABOVE QUESTION


SOLUTION CODE




#include<iostream>


using namespace std;


int main()


{
 //prompt the user to enter the radius of the circle
 int radius;
 cout<<"\nEnter the radius of the circle: ";
 cin>>radius;
 double pi = 3.14;
 //calculate the surface area of the sphere
 double surface_area_of_a_sphere = 4 * pi * radius * radius;
 
 cout<<"\nThe radius of the circle = "<<radius<<endl;
 
 cout<<"\nThe surface area of the sphere =  "<<surface_area_of_a_sphere<<endl;
 


  return 0;


}


SAMPLE PROGRAM OUTPUT






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