I wanted to print prime numbers that are palindrome between 1 and 1000. I am not getting the desired O/P with my code as below:
public static void main(String[] args)
{
for (int i=2;i<100 ;i++)
{
if (i%2!=0 && i%3!=0) //condition to get prime number
{
int rev=0; // block for palindrome check
int temp=i;// stored the i value for comparing palindrome
for (;i!=0;i/=10)
{
int rem= i%10;
rev=rev*10+rem;
}
if (temp==rev)
{
System.out.println(temp);
}
}
}
}
Answers
Answered by
2
Answer:
See this. There are two attachments.
Explanation:
I hope this will help you..Please mark this answer as the brainliest.
Attachments:
Similar questions
Biology,
4 months ago
Social Sciences,
4 months ago
Social Sciences,
9 months ago
Science,
9 months ago
Physics,
1 year ago
English,
1 year ago