:rolleyes: Hello All,
I am very new to writing Java program so am here looking for help but most I want learn more about java. I am try to understand the code but it does not click for me.
My question is: I am trying to write a program to create an array size of 25 and fill it with 5 digit palindromes. I also need to print out how many of the 25 are even and how many are odd.
Now, I know how to make the array of 25 and I set it up so that the palindromes are ramdonly pick but I have to compare the digit to make sure that they are palindromes. How should I do that! How do I compare cell of the Array or should I convert the number into strings!

This is what I have so far:

//class palindromesarray
 
class palindromesarray
{
              public static void main(String args[])
                {
                   int number[];
                   number = new int[25];
                   for(int i = 0; i < 25; i++) number[i] = (int)Math.floor(Math.random()*100000+1);
                  for(int i=0; i<25; i++)
                  System.out.println(number[i]);
                }
}
Member Avatar for iamthwee

How should I do that! How do I compare cell of the Array or should I convert the number into strings!

Do whatever you're allowed. If you can cannot convert to a string then use the modulus operator to separate the digits.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.