1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kipiarov [429]
3 years ago
15

Write a program that prompts the user to enter two positive integers less than 1,000,000,000 and the program outputs the sum of

all the prime numbers between the two integers. Two prime numbers are called twin primes, if the difference between the two primes is 2 or -2. Have the program output all the twin primes and the number of twin primes between the two integers.
Computers and Technology
1 answer:
alexira [117]3 years ago
7 0

Answer:

In Python:

low = int(input("Low: "))

high = int(input("High: "))

if low >= 1000000000 or high >=1000000000:

   print("Out of range")

else:

   mylist = []

   for num in range(low,high+1):

       flag = False

       if num > 1:

           for i in range(2, num):

               if (num % i) == 0:

                   flag = True

                   break

       if not flag:

           mylist.append(num)

           print(num, end = " ")

   print()

   print("The twin primes are: ",end="")

   count = 0

   for i in range(1,len(mylist)):

       if mylist[i] - mylist[i-1] == 2:

           print(str(mylist[i])+" & "+str(mylist[i-1]),end=", ")

           count+=1

   print()

   print("There are "+str(count)+" twin primes")

Explanation:

See attachment for complete program where comments were used to explain each line

Download txt
You might be interested in
Can someone tell me? I have an assignment in C++: I have to do three codes please tell me should i do them in one project or in
Nastasia [14]

Answer:

in my opinion if you have to do three codes in your C++ , you should of course do them in one project. but while submitting you should send the projects individually

6 0
3 years ago
Which term refers to the capability of a switch to copy data from any or all physical ports on a switch to a single physical por
pantera1 [17]

Answer:

The correct answer to the following question will be "Port mirroring".

Explanation:

A network traffic analysis tool, recognized as the Port Mirroring.

  • Also known as the Switch port analyzer.
  • The switch transfers a replica among all networking transmissions viewed on one port (or even a whole VLAN) to the next port, wherein the packet could be evaluated, through port mirroring disabled.

Therefore, Port mirroring is the right answer.

3 0
3 years ago
On what dates did the 2016 Olympics take place( list all)
kow [346]
Hi!

The 2016 Olympics took place from August 5th, 2016 - August 21st, 2016.
3 0
3 years ago
Read 2 more answers
The database cannot be migrated to a different engine because sql server features are used in the application’s net code. The co
Nezavi [6.7K]

Answer:

Explanation:

B is correct

3 0
2 years ago
Which is NOT an example of a "Serious Game"?
Allisa [31]

Answer:

My answer to the question is Sport Activity

4 0
3 years ago
Other questions:
  • What is the difference between a denial-of-service attack and a distributed denial-of-service attacks? which is potentially more
    10·1 answer
  • A(n) ____ is a client, server, or other device that can communicate over a network and is identified by a unique number, known a
    10·1 answer
  • Plz answer me will mark as brainliest ​
    7·2 answers
  • A collection of facts can be copyrighted, but only if the collection is ____ in a way that causes the resulting work to rise to
    14·1 answer
  • Which is a good guideline to follow when choosing a background for your slides?. . A. Use a different background for each slide.
    8·1 answer
  • 1. Which of the following should NOT be in a tagline?
    12·1 answer
  • Which of the following data recording procedures is best used for behaviors that have a clear ending and beginning, do not occur
    12·1 answer
  • A noisy signal has been uploaded to D2L in the files fft_signal.mat and fft_signal.txt.Write a program to estimate the power spe
    10·1 answer
  • ___________ is a technique that uses IT to develop an ongoing relationship with the purchasers or buyers of an organization's pr
    13·1 answer
  • 9. What command do you enter in the Explorer search box to access the Remote Admin share on the computer named Fin?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!