Esempio n. 1
0
        public void EnumeratePreviousNumber(out int outputNumber, ref double sum)
        {
            int lastOutputNumber = (int)OutputNumbers.LastOrDefault();

            RemoveLastElement();
            sum         += Math.Pow(lastOutputNumber, 2);
            outputNumber = lastOutputNumber - 1;

            if (!CheckIfOutputNumberIsCorrect(outputNumber) && OutputNumbers.Count == 0)
            {
                outputNumber = -1;
            }

            else if (!CheckIfOutputNumberIsCorrect(outputNumber))
            {
                EnumeratePreviousNumber(out outputNumber, ref sum);
            }
        }
Esempio n. 2
0
 public void EnumeratePreviousNumberWhenAllMembersFound(out int outputNumber, ref double sum)
 {
     sum += Math.Pow(OutputNumbers.LastOrDefault(), 2);
     RemoveLastElement();
     EnumeratePreviousNumber(out outputNumber, ref sum);
 }