internal class Program { private static void Main(string[] args) { //declares variables string Input = ""; float Radius = 0; float Height = 0; double Pi = 3.142; float RadiusSquared = 0; float HeightDivided = 0; double Volume = 0; Boolean RadiusT = false; Boolean HeightT = false; Boolean ConvertOK = false; do//initiates a loop statement { Console.WriteLine("What is the radius");//outputs text to user Input = Console.ReadLine();//inputs answer from user ConvertOK = float.TryParse(Input, out Radius);//converts a string to integer if (ConvertOK) if (Radius < 1)//will use this if condition if the number is less than 1 { Console.WriteLine("Please enter a valid number");//outputs text to user } else//if conditions are not met { Console.WriteLine("Radius is accepted, the radius is " + Radius);//outputs text to user RadiusT = true;//sets a boolean to true } } while (RadiusT == false);//ends loop when condition is met do//initiates a loop statement { Console.WriteLine("What is the height");//outputs text to user Input = Console.ReadLine();//inputs answer from user ConvertOK = float.TryParse(Input, out Height);//converts a string to integer if (ConvertOK) if (Height < 1)//will use this if condition if the number is less than 1 { Console.WriteLine("Please enter a valid number");//outputs text to user } else//if conditions are not met { Console.WriteLine("Height is accepted, the height is " + Height);//outputs text to user HeightT = true;//sets a boolean to true } } while (HeightT == false);//ends loop when condition is met RadiusSquared = Radius * Radius;//calculates radius squared HeightDivided = Height / 3;//calculates height divided by 3 Volume = Pi * RadiusSquared * HeightDivided;//caclucated the volume of the cone Volume = Math.Round(Volume, 2);//round the volume to 2 decimal points Console.WriteLine(Volume);//output the volume for the user Console.ReadKey(); } }