Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Challenge 1");
            Console.Write(Environment.NewLine);
            //int[] arr = new int[5] { 2, 2, 2, 2, 2 };
            //Console.WriteLine($"[{arr[0]},{arr[1]},{arr[2]},{arr[3]},{arr[4]}]");
            Console.WriteLine($"Final Score: {Challenge1.Grade(Challenge1.CheckArray(), Challenge1.ChooseNumber())}");
            Console.Write(Environment.NewLine);

            Console.WriteLine("Challenge 2");
            Console.Write(Environment.NewLine);
            Console.WriteLine(Challenge2.LeapYear());
            Console.Write(Environment.NewLine);

            Console.WriteLine("Challenge 3");
            Console.Write(Environment.NewLine);
            int[] test = new int[3] {
                1, 3, 2
            };
            Console.WriteLine(Challenge3.CheckSequence(test));
            Console.Write(Environment.NewLine);

            Console.WriteLine("Challenge 4");
            Console.Write(Environment.NewLine);
            int[,] myArray = new int[3, 5] {
                { 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 10 }, { 11, 12, 13, 14, 15 }
            };
            for (int x = 0; x < myArray.GetLength(0); x++)
            {
                Console.Write("[");
                for (int i = 0; i < myArray.GetLength(1); i++)
                {
                    Console.Write(string.Format("{0}", myArray[x, i]));
                    if (i < myArray.GetLength(1) - 1)
                    {
                        Console.Write(",");
                    }
                }
                Console.Write("]");
                Console.Write(Environment.NewLine);
            }
            Console.Write(Environment.NewLine);
            Console.WriteLine("Sum of Each Row");
            Console.WriteLine("[" + string.Join(",", Challenge4.RowSum(myArray)) + "]");
        }
        public void Reverse120()
        {
            Challenge2 ch2 = new Challenge2();

            Assert.AreEqual(21, ch2.ReverseNumber(120));
        }
        public void ReverseNumberTest()
        {
            Challenge2 ch2 = new Challenge2();

            Assert.AreEqual(-321, ch2.ReverseNumber(-123));
        }
        public void Reverse2568()
        {
            Challenge2 ch2 = new Challenge2();

            Assert.AreEqual(8652, ch2.ReverseNumber(2568));
        }