{static decimal pi = 3.14159M;
static private decimal VCON(decimal r, decimal h)
return (1M / 3M) * pi * r * r * h;
static private decimal VSPH(decimal r)
return (4M / 3M) * pi * r * r * r;
static private decimal VCYL(decimal r, decimal h)
static private decimal SACone(decimal r, decimal h)
double r2 = (double)r * (double)r;
double h2 = (double)h * (double)h;
double slant = Math.Sqrt(r2 + h2);
return pi * r * r + pi * r * (decimal)slant;
static private decimal SASphere(decimal r)
static private decimal SACyl(decimal r, decimal h)
return 2M * pi * r2 + 2M * pi * r * h;
static private decimal SaofCone(decimal r, decimal h)
{ double r2 = (double)r * (double)r;
double h2 = (double)h * (double)h;
double slant = Math.Sqrt(r2 + h2);
return pi*r *r + pi * r * (decimal)slant;
static private decimal Sphere( decimal r)
static private decimal cylinder( decimal r, decimal h)
return 2 * pi * r * h + 2 * pi *r2;
public static void Main()
string restart = "random";
Console.WriteLine("Please enter 1 to find the surface area and volume of a Cone, 2 for the surface area and volume of a Cylinder, 3 for the surface area and volume of a Sphere");
string choice = Console.ReadLine();
{ Console.WriteLine("Please enter the raduis and height");
decimal raduis = decimal.Parse(Console.ReadLine());
decimal height = decimal.Parse(Console.ReadLine());
Console.WriteLine("The surface area of the cone is " + SaofCone(raduis, height).ToString("##.##"));
Console.WriteLine("The volume of the cone is " + VCON(raduis, height).ToString("##.##"));
Console.WriteLine("Press q to quit or any other key to continue");
restart = Console.ReadLine();
{ Console.WriteLine("Please enter the raduis and height");
decimal raduis = decimal.Parse(Console.ReadLine());
decimal height = decimal.Parse(Console.ReadLine());
Console.WriteLine("The surface area of the cylinder is " + cylinder(raduis, height).ToString("##.##"));
Console.WriteLine("The Volume of the cylinder is " + VCYL(raduis, height).ToString("##.##"));
Console.WriteLine("Press q to quit or any other key to continue");
restart = Console.ReadLine();
{ Console.WriteLine("Please enter the raduis");
decimal raduis = decimal.Parse(Console.ReadLine());
Console.WriteLine("The surface area of the Sphere is " + Sphere(raduis).ToString("##.##"));
Console.WriteLine("The volume of the Sphere is " + VSPH(raduis).ToString("##.##"));
Console.WriteLine("Press q to quit or any other key to continue");
restart = Console.ReadLine();
{ Console.WriteLine("Please enter an option");