c++ coding for calculate the volume and curved surface are of cylinder
Answers
#include <bits/stdc++.h>
#define PI 3.14159
using namespace std;
// Function To Calculate Volume OF Cylinder
void volume(float r, float h)
{
float vol = PI * r * r * h;
cout << "Volume of Cylinder = " << vol << "\n" ;
}
// Function To Calculate Total Surface Area OF Cylinder
void totalsurfacearea(float r, float h)
{
float tsurf_ar = (2 * PI * r * h) + (2 * PI * r * r);
cout << "Total Surface Area Of Cylinder = " << tsurf_ar << "\n";
}
// Function To Calculate Curved Surface Area OF Cylinder
void curvedsurfacearea(float r, float h)
{
float cursurf_ar = (2 * PI * r * h);
cout << "Curved Surface Area Of Cylinder = "
<< cursurf_ar << "\n";
}
// Driver code
int main()
{
float r = 5;
float h = 8;
volume(r, h);
totalsurfacearea(r, h);
curvedsurfacearea(r, h);
}
Step-by-step explanation:
#include <bits/stdc++.h>
#define PI 3.14159
using namespace std;
// Function To Calculate Volume OF Cylinder
void volume(float r, float h)
{
float vol = PI * r * r * h;
cout << "Volume of Cylinder = " << vol << "\n" ;
}
// Function To Calculate Total Surface Area OF Cylinder
void totalsurfacearea(float r, float h)
{
float tsurf_ar = (2 * PI * r * h) + (2 * PI * r * r);
cout << "Total Surface Area Of Cylinder = " << tsurf_ar << "\n";
}
// Function To Calculate Curved Surface Area OF Cylinder
void curvedsurfacearea(float r, float h)
{
float cursurf_ar = (2 * PI * r * h);
cout << "Curved Surface Area Of Cylinder = "
<< cursurf_ar << "\n";
}
// Driver code
int main()
{
float r = 5;
float h = 8;
volume(r, h);
totalsurfacearea(r, h);
curvedsurfacearea(r, h);
}