C# Program to Find the Volume of a Cylinder

/* C# Program to Find the Volume of a Cylinder */
using System;
public class Demo
{
    public static void Main(string[] args)
    {
        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);

        Console.ReadLine();
    }
}

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

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



Leave a comment