Answer to Question #240314 in C++ for adil

Question #240314

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+


1
Expert's answer
2021-09-23T17:48:25-0400
#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;
}

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