# Write a program that inputs the radius of a circle. It calculates area of circle if user enters 1 as choice. It calculates circumference of the circle if the user enters 2 as choice

So let’s Write Code:

## Algorithm of Code

- Start
- Input Radius
- Input Operator
- Apply switch statement to check whether the choice is 1 or 2.
- if choice is 1 calculate the area
- if choice is 2 calculate the circumference.
- end

Write a program that inputs the radius of a circle. It calculates the area of a circle if a user enters 1 as a choice. It calculates the circumference of the circle if the user enters 2 as a choice

```
#include"iostream"
using namespace std;
main()
{
float radius, area, circum;
int op;
cout<<"Enter radius of circle ? ";
cin>>radius;
cout<<"1-Area of circle "<<endl;
cout<<"2-Circumference of circle "<<endl;
cout<<"Enter your choice [1-2]? ";
cin>>op;
switch(op)
{
case 1:
area = 3.141*radius*radius;
cout<<"Area of circle :"<<area;
break;
case 2:
circum = 2.0*3.141*radius;
cout<<"Circumference of circle :"<<circum;
break;
}
}
```

Hope You will learn Something From Here: