C# Chapters

C# Program to Find the Volume and Surface Area of cylinder.

Variables and Constants - C# Language Fundamentals
using System;

public class Program
{
    public static void Main()
    {
        Decimal Radius, Height, Volume, Surface_Area, PI = (Decimal)3.14;
        
        Console.Write("Enter Radius of Cylinder : ");
        Radius = Convert.ToDecimal(Console.ReadLine());
        
        Console.Write("Enter Height of Cylinder : ");
        Height = Convert.ToDecimal(Console.ReadLine());
        
        Volume = PI * Radius * Radius * Height;
        Surface_Area = 2 * PI * Radius * (Radius + Height);
        
        Console.Write("\nVolume of Cylinder is : " + Volume);
        Console.Write("\nSurface Area of Cylinder is : " + Surface_Area);
    }
}

Output :
Enter Radius of Cylinder : 10
Enter Height of Cylinder : 20

Volume of Cylinder is : 6280 .00
Surface Area of Cylinder is : 1884.00

Description :

Volume of cylinder can be calculated as
Volume = Π x R 2 x H
Π = 3.14 (GREEK CAPITAL LETTER PI)
R = Radius of Sphere
H = Height of Cylinder

Surface Area of sphere can be calculated as :
Area = = 2 x Π x R x (R+ H)


Leave a comment
Recent Comments
No Comments