Computer Science, asked by Anonymous, 9 months ago

WAP in java that displays the first 100 palindromic prime numbers​

Answers

Answered by debosmita75
5

Answer:

public class PalindromicPrime { public static void main(String[] args) { final int total = 100; final int displayPerLine = 10; int count = 1; int number = 2; while (count <= total) { if (isPrime(number) && isPalindrome(number)) { System.out.print(number + " "); if (count % displayPerLine == 0) System.out.println(); count++; } number++; } } /* Test if the number is Prime */ public static boolean isPrime(int num)

Hope this helps you

Answered by rishabhshah2609
0

Answer:

Explanation:

public class PalindromicPrime { public static void main(String[] args) { final int total = 100; final int displayPerLine = 10; int count = 1; int number = 2; while (count <= total) { if (isPrime(number) && isPalindrome(number)) { System.out.print(number + " "); if (count % displayPerLine == 0) System.out.println(); count++; } number++; } } /* Test if the number is Prime */ public static boolean isPrime(int num)

Similar questions