Skip to content

Instantly share code, notes, and snippets.

@cschlisner
Created April 3, 2014 06:38
Show Gist options
  • Save cschlisner/9949342 to your computer and use it in GitHub Desktop.
Save cschlisner/9949342 to your computer and use it in GitHub Desktop.
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