Esempio n. 1
0
        public void start()
        {
            Console.WriteLine("Find the largest palindrome made from the product of two whole numbers between 0-999.");
            Console.WriteLine("E.g. if you give 999 and 999 as input, you should receive 906609 as an answer.");



            Console.Write("1. number: ");
            string userInput1 = Console.ReadLine();

            Console.Write("2. number: ");
            string userInput2 = Console.ReadLine();

            try
            {
                int input1 = System.Convert.ToInt32(userInput1);
                int input2 = System.Convert.ToInt32(userInput2);
                LargestPalindromeProduct largestProduct = new LargestPalindromeProduct(input1, input2);
                Console.WriteLine("result: " + largestProduct.BiggestPalindromeNumber());
                Console.WriteLine("_______________________________________________________________________________________");
            }
            catch
            {
                Console.Clear();
                Console.WriteLine("please try again");
                Console.WriteLine("_______________________________________________________________________________________");
            }
        }
        public void IsPrime_InputIs1_ReturnFalse()
        {
            LargestPalindromeProduct lpp = new LargestPalindromeProduct(10000000, 1948948498);
            string res = lpp.BiggestPalindromeNumber();

            Assert.Equal(res, "I couldn't find a palindrome product, did you insert whole numbers between 0 and 9999?");
        }
        public void intIsPalindrome()
        {
            LargestPalindromeProduct lpp = new LargestPalindromeProduct(999, 999);

            Assert.Equal("906609", lpp.BiggestPalindromeNumber());
        }