Program to find the area of the circle and area of cylinder - Learn in the easy way

Happy Learning...

ads

Post Top Ad

Program to find the area of the circle and area of cylinder

Share This
Code of the program:
#include<iostream>
using namespace std;
int main()  {
             float r,area;
             const float PI=3.14;
             cout<<"Enter number to find the area of the circle"<<endl;
             cin>>r;
             area = PI*(r*r);
             cout<<"area of the circle is: "<<area;
             return 0;
}
Output:



Code#2:
#include<iostream>
using namespace std;
int main()
{
             float r,area;
             const float PI=3.14;
             cout<<"Enter the value to calculate the area of the cylender"<<endl;
             cin>>r;
             area = 2*PI*r;
             cout<<"Area of cylender is = "<<area<<endl;
}

Output:

1 comment:

Tell me What can I do for you.....Comment, please

Post Bottom Ad

Pages