Home /
Expert Answers /
Computer Science /
write-a-program-that-meets-the-following-requirements-the-program-must-prompt-the-user-to-enter-tw-pa592

Write a program that meets the following requirements: The program must prompt the user to enter two positive integers less than 1,000,000,000. The program must verify that the first integer entered by the user is less than the second. If this is not the case, the program must print an error and give the user another chance to enter the input correctly. The program will keep printing the error and prompting the user until the input is entered correctly. The program must verify that both integers are positive. If this is not the case, the program must print an error and give the user another chance to enter the input correctly. The program will keep printing the error and prompting the user until the input is entered correctly. The program must output the sum of all the prime numbers between the two integers. The program must output all the twin primes between the two integers. Two prime numbers are called twin primes, if the difference between the two primes is 2 or ?2. The program must contain at least the following functions: isPrime: A value-returning function that checks if a number is prime. It must return true if the number is prime or false if the number is not prime. sumOfPrimes: A value-returning function that calculates the sum of all prime numbers within a given range. It must take two integers as arguments representing the start and end of the range of numbers entered by the user. It must return the sum of the prime numbers. printTwinPrimes: A void function that prints all twin primes within a given range. It must take two integers as arguments representing the start and end of the range of numbers entered by the user. The program must contain loops. must be written in c++