public void Calculate() { IChecker Checker = new PalindromeChecker(); int number1 = 999; int number2 = 999; int result = number1 * number2; int highestValue = 0; bool isPalindrome = false; while (number2 > 0) { number1 = number2 - 1; for (number1 = 999; number1 > 1; number1--) { result = number1 * number2; isPalindrome = Checker.isPalindrome(result); if (isPalindrome) { if (number1 < 100 || number2 < 100) { break; } Console.WriteLine("{0} * {1} = {2}",number1,number2,result); highestValue = Math.Max(highestValue,result); break; } } number2--; } Console.Write("Highest value is: " + highestValue); }
static void Main(string[] args) { ICalculator Calculator = new PalindromeCalculator(); IChecker Checker = new PalindromeChecker(); Calculator.Calculate(); Console.ReadLine(); }