Computer Science, asked by angela1001, 1 year ago

Please answer this question...

Attachments:

Answers

Answered by anirbanroy
1
import java.util.*;
public class twistedprime
{
public static void main()
 
{

Scanner sc=new Scanner(System.in);
int n, r, m, i, j, g, s=0, k=0, c=0;

System.out.println("Enter a number");

 n=sc.nextInt();

  m=n;

int p=m;

while(m!=0)

{
 r=m%10;
 s=(s*10)+r;

 m=m/10;

}

for(i=1;i<=n;i++)

{
if(n%i==0)
{

k++;

}
}
for(j=1;j<=s;j++)
{
if(s%j==0)
{

 c++;

}
}
if(k==2 && c==2)

System.out.println(p+" is twisted prime");
else
System.out.println(p+" is not twisted prime");
}
}
Similar questions