Example #1
0
        public static bool TestIsSummation()
        {
            var x         = new Random().Next(1, 10000);
            var Summation = 0;

            for (int i = 0; i <= x; i++)
            {
                Summation = Summation + i;
            }
            if (Recursion.Summation(x) != Summation)
            {
                return(false);
            }
            return(true);
        }
Example #2
0
        //****************************************************************
        //test Q 8 recrsion
        //****************************************************************

        public static bool TestIsFactorial()
        {
            var x         = new Random().Next(1, 10000);
            var factorial = 1;

            for (int i = 1; i <= x; i++)
            {
                factorial = factorial * i;
            }
            if (Recursion.Factorial(x) != factorial)
            {
                return(false);
            }
            return(true);
        }