answersLogoWhite

0


Best Answer

public class TwistedPrime

{

public static void main(int n)//Enter a number

{

int num,s=0,c=0,d;

num=n;

while(n>0)

{

d=n%10;

s=s*10+d;

n=n/10;

{

for(int i=1;i<s;i++)

{

if(s%i==0)

c++;

}

}

}

if(c==1)

System.out.print("Number is Twisted Prime");

else

System.out.print("Number is not T.P.");

}

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a java program to check a number is twisted prime or not?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Is the number 1663561 a prime number?

No, it is not. You can check on prime-numbers.org


With a given big integer number which is the product of two prime numbers how do you find them?

First write a program to generate the prime number. After one prime number was generated, divide the big int number by the prime number. If the remainder is zero then quotient is the second prime number ( also it is important to check whether the quotient is prime number or not because sometimes you will get wrong answer). Repeat the process until you get the result.


Is 4343 a prime number?

No its not a prime number Check out related links


What is the Program for composite and prime numbers in c?

#include&lt;iostream.h&gt; #include&lt;conio.h&gt; int main() { int i,n; clrscr(); cout&lt;&lt;"PROGRAM TO CHECK IF THE NUMBER IS PRIME OR NOT:"&lt;&lt;endl; cout&lt;&lt;"Enter a number:"; cin&gt;&gt;n; for(int i=2;i&lt;n;i++) { if(n%i==0) cout&lt;&lt;"\nTHE NUMBER IS COMPOSITE"&lt;&lt;endl; else cout&lt;&lt;"\nTHE NUMBER IS PRIME"&lt;&lt;endl; } return 0; }


How do you check if a number is a prime or not?

A prime number can only be divided by itself and 1


A program to find that the input number is prime or not?

Use Wolfram|Alpha... go to the related link below, Wolfram|Alpha, and type in (is __ (number) prime) and then the program will compute that and tell you if it is prime or composite.


Write a java programme to check whether the number is twin prime or not?

Find a prime number, add 2 to the number. Check if the new number is prime. IE : 3 is prime. 3+2 =5. 5 is prime. (3,5) are twin primes.


What is the largest prime number you have to check to decide if 221 is prime?

13


What is the largest prime number to check for prime numbers under 100?

the largest prime number under 100 is 97


Write a program to find of all prime number between 100and 500?

#include&lt;stdio.h&gt; main() { int check, i, x,y,m; printf("enter the number upto which check"); scanf("%d",&amp;check); y=1; for(m=2; m&lt;=check; m++) { for(x=2;x&lt;m; x++) { y=m%x; if(y==0) break; } if(y!=0) printf("%d is prime number\n",m); else printf("%d is not a prime number\n",m); } getch(); }


Program for print prime all number from 1 to 100 in foxpro?

Prime numbers are numbers that are only divisible by themselves and the number 1. You can write a program to print all prime numbers from 1 to 100 in FoxPro.


How can you check whether a number is prime or not by a C program using functions?

#include&lt;iostream.h&gt; #include&lt;conio.h&gt; void prime(int n) { clrscr(); int num; cout&lt;&lt;"enter the numbers"&lt;&lt;endl; cin&gt;&gt;num; prime(num); getch(); } void prime(int n) { int prime=1,i; for(i=2;i&lt;=n/2;i++) if(n%i==1) prime=0; if(prime==1) cout&lt;&lt;"the number"&lt;&lt;n&gt;&gt;"is prime"; else cout&lt;&lt;"the number"&lt;&lt;n&lt;&lt;"is not prime"; }