Twin Prime Number Using Function in JAVA
Twin Prime Number using Function in JAVA Twin Prime Number : A Twin Prime is a prime number that is either 2 less or 2 more than another prime number— For example, ( 41 , 43 ) are twin pairs. In other words, a twin prime is a prime that has a prime gap of two . Algorithm to check whether two numbers are Twin prime or not :- Input two numbers Check both the numbers are prime or not Check if the difference between the numbers is equal to 2 or not If both the numbers are prime and difference is equal to 2 Print "Numbers are Twin Prime" Else print "Numbers are not Twin Prime"