A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
int number1; int number2; int highest = 0; int temp; for (number1=100; number1<999; number1++) { for (number2=100; number2<999; number2++) { temp = number1*number2; if (Integer.toString(temp).equals(new StringBuffer(Integer.toString(temp)).reverse().toString())) { if (temp>highest) { highest = temp; System.out.println(number1 + " * " + number2 + " = " + highest); } } } }
Lösung: 906609