static decimal pi = 3.14159M;
static private decimal sphere(decimal r)
decimal spherevol = (4M / 3M * pi * r * r * r);
static private decimal cylinder(decimal r, decimal h)
decimal cylindervol = (pi * r * r * h);
static private decimal cone(decimal r, decimal h)
decimal conevol = (h / 3M * pi * r * r);
public static void Main()
Console.WriteLine("type 1 if you would like to find the volume for a sphere, 2 for a cylinder, and 3 for a cone.");
string choice = Console.ReadLine();
Console.WriteLine("You chose the sphere, Please enter a radius.");
decimal radius = decimal.Parse(Console.ReadLine());
Console.WriteLine("The volume for the sphere is " + sphere(radius) + ".");
Console.WriteLine("Would you like to run the program again? y/n");
string choice2 = Console.ReadLine();
if (choice2 == "y" || choice2 == "Y")
Console.WriteLine("You chose the sphere, Please enter a radius.");
decimal radius2 = decimal.Parse(Console.ReadLine());
Console.WriteLine("Now, enter a number for the height.");
decimal height = decimal.Parse(Console.ReadLine());
Console.WriteLine("The volume for the cylinder is " + cylinder(radius2, height) + ".");
Console.WriteLine("Would you like to run the program again? y/n");
string choice2 = Console.ReadLine();
if (choice2 == "y" || choice2 == "Y")
Console.WriteLine("You chose the cone, Please enter a radius.");
decimal radius3 = decimal.Parse(Console.ReadLine());
Console.WriteLine("Now, enter a number for the height.");
decimal height = decimal.Parse(Console.ReadLine());
Console.WriteLine("The volume for the cone is " + cone(radius3, height) + ".");
Console.WriteLine("Would you like to run the program again? y/n");
string choice2 = Console.ReadLine();
if (choice2 == "y" || choice2 == "Y")