For a given radius of a circle, calculate the area and print the size accordingly:
Size area
Size closed
Small 0-20
Medium 21-50
Large 50+
#include <iostream>
using namespace std;
int main()
{
double rad;
cout<<"\nEnter the radius of a circle: ";
cin>>rad;
double area=3.142*rad*rad;
cout<<area;
if (rad>=0 && area<=20){
cout<<"\nSmall";
}
else if (area>=21 && area<=50){
cout<<"\nMedium";
}
else if (area>50){
cout<<"\nLarge";
}
return 0;
}
Comments
Leave a comment