answersLogoWhite

0


Best Answer

class Twin_Prime

{

void Prime(int n,int m)

{

int a=0;

int b=0;

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

{

if(m%i==0)

{

a=a+1;

}

if(n%i==0)

{

b=b+1;

}

}

if(a==2)

if(b==2)

{

if(m-n==2)

{

System.out.print("The numbers "+m+" and "+n+" are Twin Prime");

}

else

if(n-m==2)

{

System.out.print("The numbers "+m+" and "+n+" are Twin Prime");

}

}

else

{

System.out.print("They are not Twin Primes");

}

}

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a programme in bluej to accept two numbers and check whether they are twin prime or not.?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a program to accept 2 numbers and tell whether the product of the two number is equal to or greater than 1000?

C programm


How do i Write a programme to show the fabonasi numbers?

Step 1. Learn the word "Fibonacci"...


Write a c programme to print all the even numbers in descending order?

#include(stdio.h) int main ()


Write a programme for substraction of two numbers in c language?

substracion of any two number program in c


Write a c program to accept a numbers and generate square root cube and exponential values?

write a c program to accept a number and generate a square root cube and exponential values


How do you write the pseudo codes that will accept 7 numbers and display their sum?

Start accept 7 number calculate sum print sum stop


How can you write an explanation letter for lacking of proof of employment?

You can write a simple letter stating why you don't have proof of employment. It will be up to the company whether they accept your letter or not.


Write an algorithm to check whether a number is a prime number or not?

You can write out this algorithm. This will then be programmed into the device to make determining prime numbers easier.


Write a programme to find greater among two numbers in c plus plus?

You could use an if, but the ternary operator is especially compact for this purpose: result = a &gt; b ? a : b;


Write an algorithm that accept five numbers add them together and output the results instruct?

dont know use google instead dumb


How do write searching number programme in java?

give description of that then i will send the answer


How do you write one thousand pounds in numbers?

1000. The symbol for the measurement units and whether it comes before or after the numbers depends on whether it is a measure of mass or currency and, in the latter case, the currency of which country.