Question: We want you to assist mathematicians by writing a program that will check if 2 numbers are Twin Primes or not. 1 . Your program

We want you to assist mathematicians by writing a program that will check if 2
numbers are Twin Primes or not.
1. Your program should start by asking for the 2 numbers.
2. First check if the input numbers are prime.
If not, say which number is NOT prime, and keep 'looping' till a
valid prime number is entered - see execution sample below.
It is advised to define a function isPrime() that returns 1
(true) if the number is prime and 0(false) otherwise.
It is not mandatory to implement an isPrime function. You
can write its equivalent code (i.e., the while loop where you
check for divisors)
3. If both numbers are prime, then check if they are twins, i.e., p1 p2=2.
4. We want your program to keep executing till the user wants to stop it,
e.g., by answering a choice question (y/n)?. To do so, ember your code in
a while loop.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!