Example #1
0
        static void Main(string[] args)
        {
            List <int> numbers = new List <int>
            {
                4, 2, 2, 5, 2, 3, 2, 3, 1, 5, 2
            };

            List <int> subSequence = FindLongestSubsequence(numbers);

            IOOperations.PrintNumbers(subSequence);
        }
Example #2
0
        static void Main(string[] args)
        {
            List <int> numbers = new List <int>
            {
                4, 2, 2, 5, 2, 3, 2, 3, 1, 5, 2
            };

            List <int> even = RemoveOddInList(numbers);

            IOOperations.PrintNumbers(even);
        }
        static void Main(string[] args)
        {
            List <int> numbers = new List <int>
            {
                1, -2, 3, -4, 5, -6, 7, -8
            };

            List <int> positiveNumbers = (from number in numbers
                                          where number > 0
                                          select number).ToList();

            IOOperations.PrintNumbers(positiveNumbers);
        }
        static void Main(string[] args)
        {
            List <int> numbers = new List <int>();

            IOOperations.GetNumbers(numbers);

            // another way
            // numbers.Sort();

            numbers = (from number in numbers
                       orderby number ascending
                       select number).ToList();

            IOOperations.PrintNumbers(numbers);
        }