Question

# Print Prime Palindrome numbers in given rangeĀ  using recursion

```				```
A prime palindrome integer is a positive integer (without leading zeroes) which is prime as well as a palindrome.
```
```
```				```
ENTER THE LOWER RANGE
1
ENTER THE UPPER RANGE
600
Prime Palindrome number between 1 and 600:
2 3 5 7 11 101 131 151 181 191 313 353 373 383
```
```

# Share code with your friends

Code

```				```
import java.util.Scanner;
{
long lowerRange=0,upperRange=0;
public void accept()
{
Scanner sc=new Scanner(System.in);
System.out.println("ENTER THE LOWER RANGE");
lowerRange=sc.nextLong();
System.out.println("ENTER THE UPPER RANGE");
upperRange=sc.nextLong();
}

public long FindReverse(long num,long reverse)
{
if(num==0)
{
return reverse;
}
else
{
reverse=reverse*10+num%10;
return FindReverse(num/10,reverse);
}
}

public  boolean checkPrime(long n,long i)
{
if(n<2)
{
return false;
}
/*Check if i is greater than n/2 because if any number is divisible by another number till another number is less than or equal to num/2*/
else if(i>(n/2))
{
return true;
}

else if(n%i==0)
{
return false;
}
else
{
return  checkPrime(n,(i+1));
}
}

public void display()
{
long i=0;
System.out.println("Prime Palindrome number between "+lowerRange+" and "+upperRange+":");
for(i=lowerRange;i<=upperRange;i++)
{
if(checkPrime(i,2)==true && i==FindReverse(i,0))
{
System.out.print(i+" ");
}
}

}
public static void main(String args[])
{
ob1.accept();
ob1.display();
}

}

```
```

Sale

50
Sale

150
Sale

200
Sale

50
Sale

50
Sale

50
Sale

50
Sale

50
Sale

50