Question is in the attachment.
Don't SpaM
Answers
The given problem is solved using language - Java.
import java.util.Scanner;
public class Java{
public static void main(String s[]){
System.out.println("First 100 Pal Prime Numbers are - ");
for(int i=1,c=1;i<=100;c++){
if(isPrime(c)&&isPalindrome(c))
System.out.printf("%d. %d\n",i++,c);
}
}
static boolean isPalindrome(int n){
return n==Integer.parseInt(new StringBuilder(n+"").reverse().toString());
}
static boolean isPrime(int n){
if(n==1)
return false;
for(int i=2;i<n;i++){
if(n%i==0)
return false;
}
return true;
}
}
- The function isPrime() and isPalindrome() checks whether a number is prime and palindrome or not.
- These two functions are called inside main so as to display the first 100 pal-prime numbers.
Engineeringcomputer sciencecomputer science questions and answersa palindromic prime is a prime number and also palindromic. for example, 131 is a prime and also a palindromic prime, as are 313 and 757. write a program that displays the first 100 palindromic prime numbers.
display 10 numbers per line, separated by exactly one space, as follows: 2 3 5 7 11 101 131 151 181 191 313 353 373 383 727 757 787 797 919 929
Question: A Palindromic Prime Is A Prime Number And Also Palindromic. For Example, 131 Is A Prime And Also A Palindromic Prime, As Are 313 And 757.
Write A Program That Displays The First 100 Palindromic Prime Numbers. Display 10 Numbers Per Line, Separated By Exactly One Space,
As Follows:
2 3 5 7 11 101 131 151 181 191 313 353 373 383 727 757 787 797 919 929
This problem has been solved!
See the answer:
A palindromic prime is a prime number and also palindromic. For example, 131 is a prime and also a palindromic prime, as are 313 and 757. Write a program that displays the first 100 palindromic prime numbers. Display 10 numbers per line, separated by exactly one space, as follows:
2 3 5 7 11 101 131 151 181 191 313 353 373 383 727 757 787 797 919 929.
__________________________
▬▬▬▬▬▬▬▬▬▬▬▬▬▬
_________________________
Note :-
Follow the rules in the above attachment!