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
What does the format painter button do?
Eduardwww [97]

Answer:

a

Explanation:

Format Painter is used when you want to copy formatting from one item to another.

6 0
3 years ago
What is spam? electronic junk mail e-mail abuse e-mail subscriptions the e-mail server the opt out feature unethical use of e-ma
expeople1 [14]

Answer:

electronic junk mail.

Explanation:

7 0
3 years ago
You are working as a Solutions Architect for a technology company which is in the process of migrating their applications to AWS
torisob [31]

Answer: Amazon DynamoDB

Explanation: Amazon DynamoDB(Database) is the database that works in quick speed of milliseconds at any area.It has the characteristics like built-in security section, manageable, restoration function, durable etc.These features helps in handling the request of numerous people on large scale everyday.

It can work in multiple region to and can have multiple master .Thus, the database demand mentioned in the question can be completed by using Amazon DynamoDB as it can fulfill the requires of the company.

6 0
4 years ago
What is bugtraq?
beks73 [17]

Answer:

The answer would be (C) An industry mailing list provided by Symantec that reports new vulnerabilities as they are discovered.

I hope this helped!

3 0
3 years ago
Read 2 more answers
(1) Prompt the user to enter five numbers, being five people's weights. Store the numbers in an array of doubles. Output the arr
Mashutka [201]

Answer:

weights = []

total = 0

max = 0

for i in range(5):

   weight = float(input("Enter weight " + str(i+1) + ": "))

   weights.append(weight)

   total += weights[i]

   if weights[i] > max:

       max = weights[i]

average = total / 5

print("Your entered: " + str(weights))

print("Total weight: " + str(total))

print("Average weight: " + str(average))

print("Max weight: " + str(max))

Explanation:

Initialize the variables

Create a for loop that iterates 5 times

Get the values from the user

Put them inside the array

Calculate the total by adding each value to the total

Calculate the max value by comparing each value

When the loop is done, find the average - divide the total by 5

Print the results

6 0
3 years ago
Other questions:
  • In a _____, if any link between nodes is severed, the entire network is affected, and failure of a single node disrupts the enti
    9·1 answer
  • ___________ is a mass-produced, copyrighted software that meets the needs of a wide variety of users, not just a single user or
    15·1 answer
  • Compare a Wi-Fi hotspot with a cybercafé.
    6·1 answer
  • This decision control structure enables the program to execute a statement or block of codes if and only if the Boolean expressi
    7·1 answer
  • What is the general form of an internet email address<br>​
    5·1 answer
  • Plato: A university wants to install a client-server network. Which feature do you think is important for them as they set up th
    5·1 answer
  • Types of computer that we use in our daily life​
    13·2 answers
  • I need help with this!!! PLEASE!!! Are headphones, radios, dishwashers, and remote controls considered Computers? Do any of them
    10·2 answers
  • What does the CYMK tab let you do?
    5·2 answers
  • 849 352 768 493 527 sequence
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!