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
dlinn [17]
3 years ago
13

Factoring of integers. Write a python program that asks the user for an integer and then prints out all its factors. For example

, when the user enters 150, the program should print 2 3 5 5.
This is just a pseudocode for visual:
Get a value from user Print
"The factors are: "
Keep going while the value is greater than 1
Start the divisor at 2 A factor has not been found Keep going until a factor is found
If the value is evenly divisible by the divisor
A factor has been found
Print the divisor Change value to equal value / divisor.
You have now found a factor you want to see if there are factors in the remaining part of the number.
FYI: For instance if the number is 100, your first factor would be 2 and on our second time through you would need to see if there are factors of 50. This would result in another factor of 2 in the third pass and looking for factors of 25. This would result in a factor of 5 in the fourth pass and looking for factors of 5. This would result in value finally = 1 so you are done. If I enter 175, I would see 5, 5, and 7 as my results. Increment the divisor so you can see if the next number is a factor. This statement is not necessary if a factor is found, but it does not matter if it is executed because you will fall out of the inside nested if and reset the divisor to 2 if you come back in.
Computers and Technology
1 answer:
Oduvanchick [21]3 years ago
8 0

num = int(input("Enter a number: "))

i = 2

while num > 1:

   if num % i == 0:

       num = num / i

       print(i, end=" ")

       i = 2

   i += 1

I hope this helps!

You might be interested in
If you answer these questions correctly I will mark you BRAINLIST.
dezoksy [38]

Answer:

• a break element is used to break a while loop in python.

• the <p></p> element is the paragraph element in html. For example a note could be <em><p>This paragraph is important.</p> </em>When highlighting something important, use the <em>strong </em>tag or <em>mark</em> tag.

<em>• </em>the <hr> function can be used to separate a title from multiple columns or paragraphs to give a more bootstrap(probably 3 or 4) look.

• the body element is extremely important in HTML because if you don't have a body, you can't write working code-lines.

5 0
2 years ago
Select all the correct answers.
inysia [295]

Answer:

Buyers can source products from anywhere in the world.

Your purchases are delivered to the location you specify.

Explanation:

E-commerce refers to the process of buying and selling goods and services through the internet or the virtual world. The economic and business transaction done through this process constitutes electronic commerce or e-commerce.

Two advantages for buyers are that the <u>buyer can source the goods and products from all over the world and also get them delivered at the location specified</u>. This allows for an easy and effortless transaction and also saves the buyer's time and energy. With things available at just a touch of an electronic screen, the buyer can get products from anywhere and get them delivered at his/ her doorstep or for that matter, anywhere he/she wished it delivered, with no extra effort from his side.

Thus, the correct answers are the third and fourth options.

4 0
3 years ago
Which is the short structure that Redis provides for the compact representation of Sets?
Svetllana [295]

Answer:

Answered below

Explanation:

Redis provides a short structure representation for the Sets data structure, called Intset.

Intsets reduce the data size and presents short sets as a sorted array of integers. This provides an advantage of fast performance during sets operations and also low overhead.

Redis always uses inset representation so long as the set size is smaller than the configured size.

6 0
3 years ago
You can not give an exact size for a height for column width true or false
GalinKa [24]

Answer:

~false~

Explanation:

5 0
3 years ago
write a program in pseudo code to solve the following: covert a temperature input in degrees Celsius to degrees Fahrenheit and d
Tomtit [17]

Answer:

Program Start:

Declare Variables: Celsius and Fahrenheit as float

Input Celsius

Fahrenheit = (Celsius * 9/5) + 32

Print Celsius

Print Fahrenheit

End Program

Explanation:

Pseudo codes are false codes and are used to mimic actual programs.

So, the interpretation of the above code is as follows:

This line indicates the start of the program

Program Start:

The variables are declared, here

Declare Variables: Celsius and Fahrenheit as float

This line gets input for degree Celsius

Input Celsius

This line converts degree Celsius to Fahrenheit

Fahrenheit = (Celsius * 9/5) + 32

The next two lines print the degree Celsius and the equivalent degree Fahrenheit

Print Celsius

Print Fahrenheit

This indicates end of program

End Program

5 0
3 years ago
Other questions:
  • Colleen is creating a document with two minimal paragraphs of text comparing two business models for her company. She decides to
    14·2 answers
  • Which is the best method of marketing a game to casual players?
    14·2 answers
  • A ________ separates traditional voice telephone transmission from the data transmissions in the equipment located at the custom
    11·1 answer
  • The general who directed the project responsible for the "Fat Man” graduated from what alma mater in 1918? Hint: W___ P____.
    10·1 answer
  • Question 1
    14·2 answers
  • Negative methods of behavior correction include all but this:
    9·1 answer
  • Complete this code in main to perform the requested operations for a date entered by the user in this format: month dd, yyyy
    10·1 answer
  • Identify the following as True or False: (1) Naive Bayes is a linear classifier. (2) SVMs are only usable when the classes are l
    8·1 answer
  • Step of opening browser on computer​
    15·1 answer
  • Rr lyrae stars pulsate, but with shorter periods and lower luminosities than cepheids. true false
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!