public static void Main()
Console.WriteLine("Cigarette Packing \n");
Console.WriteLine("Enter diameter of cigarette: ");
diameter = Console.ReadLine();
if (Int32.TryParse(diameter, out totalDiameter) == true)
if ((totalDiameter < 1 || totalDiameter > 2))
Console.WriteLine("Input error. Please enter a valid diameter value.");
Console.WriteLine("Enter dimension value one: ");
dimensionOne = Console.ReadLine();
if (Int32.TryParse(dimensionOne, out totalDimensionone) == true)
if (totalDiameter > totalDimensionone || totalDimensionone <= 0)
Console.WriteLine("Input error. Please enter a valid dimension one value.");
Console.WriteLine("Enter dimension value two: ");
dimensionTwo = Console.ReadLine();
if (Int32.TryParse(dimensionTwo, out totalDimensiontwo) == true)
if (totalDiameter > totalDimensiontwo || totalDimensiontwo <= 0)
Console.WriteLine("Input error. Please enter a valid dimension two value.");
Console.WriteLine("Maximum number of cigarettes to be packed:{0:###} ", (totalDimensionone / totalDiameter) * (totalDimensiontwo / totalDiameter));
Console.WriteLine("Invalid Input... ");
Console.WriteLine("Invalid Input... ");
Console.WriteLine("Invalid Input... ");
Console.WriteLine("Do you want to try again?");
tryAgain = Console.ReadLine();
while ((tryAgain == "Y") || (tryAgain == "y"));
Console.WriteLine("End of program.");