Question: Write a program in java that asks the user to enter the number of emirp pairs to display and the program will display those pairs.
Write a program in java that asks the user to enter the number of emirp pairs to display and the program will display those pairs. Ensure you do input validation on the number of emirp pairs the user enters (must be greater than or equal to 1). Display 5 pairs per line, separated by exactly one space. So, for example, your first line would look like:
(13,31) (17,71) (37,73) (79,97) (107,701) .
For clarity, a prime number n must be greater than 1, and have only two factors: 1 and n.
Make sure your program implements the following methods:
public static Boolean isPrime(int num)
- Return true if number is prime
public static int reversal(int number)
- Return an integer that has the parameters digits reversed
public static boolean isPalindrome(int number)
- Return true if the number is a Palindrome
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
