Answer to Question #265485 in C++ for fiona

Question #265485

Using while or do-while. The Area of a Circle = pi *(r*r). Where pi=3.1415 and r=Radius, Make a program that will input Radius and compute and display the Area. Your program will be terminated if input zero in the radius.


1
Expert's answer
2021-11-13T10:47:02-0500
#include <iostream>
#include <iomanip>


using namespace std;




int main()
{
	float const pi=3.1415;
	float r=1;
	while(r>0){
		cout<<"Enter the raduius of the circle: ";
		cin>>r;
		if(r>0){
			float area=pi*r*r;
			cout<<fixed<<"The Area of a Circle = "<<setprecision(2)<<area<<"\n\n";
		}
	}


	return 0;
}

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