📜  计算圆柱体的体积,弯曲表面积和总表面积

📅  最后修改于: 2021-04-26 04:51:47             🧑  作者: Mango

给定圆柱体的半径和高度,计算圆柱体的体积,总表面积和弯曲表面积。

  • 气缸容积:
    圆柱体的体积定义为圆柱体所占据的三维空间量或圆柱体的存储容量。我们可以使用以下公式来计算圆柱体的体积:

  • 其中“ r ”是基部的半径,而“ h ”是圆柱体的高度。
  • 气缸总表面积
    圆柱体的表面积是恰好覆盖圆锥体外表面的正方形单位的数量。圆柱中有三个表面,一个弯曲的底面和两个圆形的底面。圆柱体的总表面积是两个圆形底面积和曲面面积之和。总表面积包括圆形顶部和底部的面积,以及曲面表面积(CSA)。
    我们可以使用公式来计算曲面表面积和总表面积:

例子:

Input  : Enter Radius Of Cylinder   5
         Enter Height Of Cylinder   8
Output : Volume       Of       Cylinder   =   628.3185307179587
         Total  Surface Area  Of Cylinder =   408.4070449666731
         Curved Surface Area  Of Cylinder =   251.32741228718345


Input  :Enter Radius Of Cylinder   15
        Enter Height Of Cylinder   10
Output :Volume       Of       Cylinder      =   7068.583470577034
        Total  Surface Area  Of Cylinder =   2356.194490192345
        Curved Surface Area  Of Cylinder =   942.4777960769379
C
#include 
#define PI 3.14159
 
// Function To Calculate Volume OF Cylinder
float volume(float r, float h)
{
    float vol = PI * r * r * h;
    printf("Volume of Cylinder = %f \n" ,  vol);
}
 
// Function To Calculate Total Surface Area OF Cylinder
float totalsurfacearea(float r, float h)
{
    float tsurf_ar = (2 * PI * r * h) + (2 * PI * r * r);
    printf("Total Surface Area Of Cylinder = %f \n" ,  tsurf_ar);
}
 
// Function To Calculate Curved Surface Area OF Cylinder
float curvedsurfacearea(float r, float h)
{
    float cursurf_ar = (2 * PI * r * h);
    printf("Curved Surface Area Of Cylinder = %f \n" ,  cursurf_ar);
}
 
// Driver Code
int main()
{
    float r = 5;
    float h = 8;
 
    // Function Call And Printing Volume, TSA, CSA Of Cylinder
    volume(r, h);
    totalsurfacearea(r, h);
    curvedsurfacearea(r, h);
    return 0;
}
// This code is contributed by Abhishek Agrawal.


C++
#include 
#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);
}
// This code is contributed by Abhishek Agrawal.


Java
// java code for illustion....
import java.io.*;
 
class GFG
{
    static double PI = 3.14159;
     
    // Function To Calculate Volume OF Cylinder
    static void volume(double r, double h)
    {
        double vol = PI * r * r * h;
            System.out.println( "Volume of Cylinder = "
                                + vol );
    }
     
    // Function To Calculate Total Surface Area OF Cylinder
    static void totalsurfacearea(double r, double h)
    {
        double tsurf_ar = (2 * PI * r * h) + (2 * PI * r * r);
        System.out.println( "Total Surface Area Of Cylinder = "
                            + tsurf_ar );
    }
     
    // Function To Calculate Curved Surface Area OF Cylinder
    static void curvedsurfacearea(double r, double h)
    {
        double cursurf_ar = (2 * PI * r * h);
        System.out.println( "Curved Surface Area Of Cylinder = "
                            + cursurf_ar );
    }
 
    // Driver code
    public static void main (String[] args)
    {
        double r = 7;
        double h = 6;
        volume(r, h);
        totalsurfacearea(r, h);
        curvedsurfacearea(r, h);
    }
}
 
// This code is contributed by Sunnysingh


Python
# Importing Math Library For The Value Of PI
import math
pi = math.pi
 
# Function To Calculate Volume OF Cylinder
def volume(r, h):
    vol = pi * r * r * h
    return vol
 
# Function To Calculate Total Surface Area
# of Cylinder
def totalsurfacearea(r, h):
    tsurf_ar = (2 * pi * r * h) + (2 * pi * r * r)
    return tsurf_ar
 
# Function To Calculate Curved Surface Area
# of Cylinder
def curvedsurfacearea(r, h):
    cursurf_ar = (2 * pi * r * h)
    return cursurf_ar
 
# Driver Code
r = 5
h = 8
# Function Call And Printing Volume, TSA, CSA Of Cylinder
print("Volume       Of       Cylinder   =  ",volume(r, h))
print("Total  Surface Area  Of Cylinder =  ",totalsurfacearea(r,h))
print("Curved Surface Area  Of Cylinder =  ",curvedsurfacearea(r,h))


C#
// C# code for illustion....
using System;
 
class GFG {
     
    static double PI = 3.14159;
     
    // Function To Calculate Volume OF Cylinder
    static void volume(double r, double h)
    {
        double vol = PI * r * r * h;
            Console.WriteLine( "Volume of Cylinder = "
                                + vol );
    }
     
    // Function To Calculate Total Surface Area
    // OF Cylinder
    static void totalsurfacearea(double r, double h)
    {
        double tsurf_ar = (2 * PI * r * h) +
                                    (2 * PI * r * r);
        Console.WriteLine( "Total Surface Area Of "
                        + "Cylinder = " + tsurf_ar );
    }
     
    // Function To Calculate Curved Surface Area
    // OF Cylinder
    static void curvedsurfacearea(double r, double h)
    {
        double cursurf_ar = (2 * PI * r * h);
        Console.WriteLine( "Curved Surface Area Of"
                  + " Cylinder = " + cursurf_ar );
    }
 
    // Driver code
    public static void Main ()
    {
        double r = 5;
        double h = 8;
         
        volume(r, h);
        totalsurfacearea(r, h);
        curvedsurfacearea(r, h);
    }
}
 
// This code is contributed by vt_m.


PHP


Javascript


输出:

Volume     Of     Cylinder =  628.3185307179587
Total Surface Area Of Cylinder =  408.4070449666731
Total Surface Area Of Cylinder =  251.32741228718345