public static void PrintQuestionWhileDone(List <int> source) { string text; do { Console.Write("Enter a number: "); text = Console.ReadLine(); if (text == "done") { break; } else if (!int.TryParse(text, out int num)) { Console.WriteLine("Please enter numeric values"); } else { source.Add(num); } } while (text != "done"); SaveNumbersToSequence.SaveNumbers(source); }
static void Main(string[] args) { List <int> numbers = new List <int>(); PrintQuestion.PrintQuestionWhileDone(numbers); SaveNumbersToSequence.SaveNumbers(numbers); ShowSourceNumber.ShowItems(numbers); Console.WriteLine(); Console.WriteLine($"The average is {numbers.Average()}."); Console.WriteLine($"The minimum is {numbers.MinFromSource()}."); Console.WriteLine($"The maximum is {numbers.MaxFromSource()}."); Console.WriteLine($"The standard deviation is {numbers.StandardDeviation()}."); Console.ReadKey(); }