/ Published in: Java
Project Euler Question 4:
"A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 x 99.
Find the largest palindrome made from the product of two 3-digit numbers."
Output:
906609
Expand |
Embed | Plain Text
import java.util.*; public class Prob4{ } // Searches for the largest numerical palindrone in the interval [start, end) private static int largestPalindrome(int start, int end){ int high = 0; for(int i = start; i < end; i++){ for(int j = start; j < end; j++){ if(isPalindrome(i * j) && ((i * j) > high)){ high = i * j; } } } return high; } } }
You need to login to post a comment.
