This problem allows us to use recursion and some type conversions.
using System; namespace Problem4 { class MainClass { // Function to check if a number is a palindrome static bool isPalindrome(string numStr) { int numLen; numLen=numStr.Length; if (numLen<=1){ return true; } else { return (numStr[0]==numStr[numLen-1] && isPalindrome(numStr.Substring(1,numLen-2))); } } // Main function public static void Main(string[] args) { int n1,n2; int maxVal=0; for (n1=100;n1<=999;n1++) { for (n2=n1;n2<=999;n2++) { if (isPalindrome(Convert.ToString(n1*n2))){ if (n1*n2>maxVal){ maxVal=n1*n2; } } } } Console.WriteLine("The answer is {0}",maxVal); } } }