internal class Program { private static void Main(string[] args) { double radius = 0; double height = 0; bool validRadius = false; // Input validation for radius while (!validRadius) { Console.WriteLine("Enter the radius of the cone:"); string radiusInput = Console.ReadLine(); if (double.TryParse(radiusInput, out radius) && radius > 0) { validRadius = true; } else { Console.WriteLine("Invalid input. Please enter a positive number for the radius."); //Valid input value for radius } } // Input validation for height bool validHeight = false; while (!validHeight) { Console.WriteLine("Enter the height of the cone:"); string heightInput = Console.ReadLine(); if (double.TryParse(heightInput, out height) && height > 0) { validHeight = true; } else { Console.WriteLine("Invalid input. Please enter a positive number for the height."); //Validation for valid input for height } } double volume = (3.142 * (radius * radius) * height) / 3; volume = Math.Round(volume, 2); // Volume value to be rounded to 2 decimal places Console.WriteLine($"The volume of the cone is: {volume}"); //Volume Output } }