unreachable statement
Hi there everyone. I have coded a problem in order to solve this question
What is the smallest int x > 2006 so that x^7 and x terminate in teh same five digits?
When I compile this program, I get the following error
C:\Documents and Settings\7531student\Desktop\Number21.java:41: unreachable statement
System.out.println("The Number is: " + x);
^
1 error
Process completed.
import java.lang.Math;
publicclass Number21
{
publicstaticvoid main (String[] args)
{
int answer;
int x = 9999;
long xtemp;
String xStr ="";
String xtempStr ="";
boolean found =false;
while (!false)
{
int lengthX;
int lengthXTemp;
String subX ="";
String subXTemp ="";
xtemp = (long)Math.pow(x,7);
xStr = String.valueOf(x);
xtempStr = String.valueOf(xtemp);
lengthX = xStr.length();
lengthXTemp = xtempStr.length();
subX = xStr.substring((lengthX-5),(lengthX-1));
subXTemp = xtempStr.substring((lengthXTemp-5),(lengthXTemp-1));
if(subX.equals(subXTemp))
{
answer = x;
found =true;
}
x++;
}
System.out.println("The Number is: " + x);
}
}

