Created
April 3, 2014 06:38
-
-
Save cschlisner/9949342 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class q4 { | |
public static void main(String args[]){ | |
int i; | |
boolean yep=false; | |
for (i=998001; i>10000; --i){ | |
if (reverse(i)!=i) | |
continue; | |
else { | |
for (int j=999; j>=100; --j) | |
if (i%j==0 && 999>i/j && i/j>100){ | |
yep=true; | |
break; | |
} | |
if (yep) break; | |
} | |
if (yep) break; | |
} | |
System.out.println(i); | |
} | |
private static int reverse(int n){ | |
int reversedNum=0; | |
while (n != 0) { | |
reversedNum = reversedNum * 10 + n % 10; | |
n = n / 10; | |
} | |
return reversedNum; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment