I forgot a ';' at my first line.
It should be in the beginning:
Scanner readinput = new Scanner(System.in);
int[] numbers = new int[5];
int reverse=0; //This will contain the reverse number later.
System.out.print(" This is a Palindrome excercise: ");
for (int i = 0; i < 5; i++) {
System.out.println("Please enter the next number: ");
numbers[i] = readinput.nextInt();
}
Next up you have to loop trough the array, and reverse it, as explained in my first post.
Tip: this
int result = (num5*10000) + (num4*1000) + (num3*100) + (num2 *10) + num1;
Can (and should) be done with a for-loop
assume the user entered 1,2,3,4,5
reverse += 1*numbers[0] is what happens in the first loop, (reverse = 1*1 = 1)
reverse += 10*numbers[1] in the second (reverse = reverse + 10*2 = 21),
reverse += 100*numbers[2] in the third... (reverse = reverse + 100*3 =321)
You see that reverse will eventually contain the reverse of the input.
Just put this in a for-loop
you'll need:
import java.lang.Math
and use Math.pow(x, y);
2^3 = 8 = Math.pow(2, 8);
Think about it.