public void IsPalindromeMinor10() { Challenge1 ch1 = new Challenge1(); Assert.IsTrue(ch1.IsPalindrome(9)); Assert.IsTrue(ch1.IsPalindrome(8)); Assert.IsTrue(ch1.IsPalindrome(7)); Assert.IsTrue(ch1.IsPalindrome(6)); Assert.IsTrue(ch1.IsPalindrome(5)); Assert.IsTrue(ch1.IsPalindrome(4)); Assert.IsTrue(ch1.IsPalindrome(3)); Assert.IsTrue(ch1.IsPalindrome(2)); Assert.IsTrue(ch1.IsPalindrome(1)); Assert.IsTrue(ch1.IsPalindrome(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 IsPalindromeNegatives() { Challenge1 ch1 = new Challenge1(); Assert.IsFalse(ch1.IsPalindrome(-52)); }
public void IsPalindrome15151() { Challenge1 ch1 = new Challenge1(); Assert.IsTrue(ch1.IsPalindrome(15151)); }