forked from rcheng9/ProjectEuler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLargestPalindromeProduct.java
More file actions
38 lines (33 loc) · 895 Bytes
/
LargestPalindromeProduct.java
File metadata and controls
38 lines (33 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* Project Euler problem for CS 196:
*
* Problem 4: Largest palindrome product
* 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.
*
* @author Raymond Cheng
* @date Sunday, February 1, 2015
*
*/
public class LargestPalindromeProduct {
/**
* @param args
*/
public static void main(String[] args) {
//UNSOLVED!
int firstNumber=100;
int secondNumber=100;
int product=-1;
int largestPalindrome=0;
while(firstNumber<1000) {
while(secondNumber<1000) {
product=firstNumber*secondNumber;
//check if product is palindrome (by going through number with /10 or %10 and changing to another reversed number and comparing?)
secondNumber++;
}
secondNumber=100;
firstNumber++;
}
}
}