:-Write a Program in C++ to Calculate the area of the circle until radius entered is zero using While Loop.
#include<iostream.h>
#include<conio.h>
#include<math.h> // for pow() function
main()
{
float radius, area;
cout<<"\n Enter the radius(to terminate enter 0):";
cin>>radius;
while(radius !=0)
{
area= 3.14*pow(radius,2);
cout<<"area is : "<<area <<"sq. units \n";
getch();
cout<<"\n Enter the radius(to terminate enter 0):";
cin>>radius;
}
}
The Output of this program :-
#include<iostream.h>
#include<conio.h>
#include<math.h> // for pow() function
main()
{
float radius, area;
cout<<"\n Enter the radius(to terminate enter 0):";
cin>>radius;
while(radius !=0)
{
area= 3.14*pow(radius,2);
cout<<"area is : "<<area <<"sq. units \n";
getch();
cout<<"\n Enter the radius(to terminate enter 0):";
cin>>radius;
}
}
The Output of this program :-
This comment has been removed by a blog administrator.
ReplyDelete