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]
2 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]2 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
What are smart mobile devices
Nezavi [6.7K]

portable computing tool

7 0
3 years ago
What is the boundary folding method?
Romashka [77]

Answer:

 Boundary folding method is basically used in the java algorithm and in the hash table. In the hash function, the left and the right value are basically folded in the fixed boundary between the given center values by using the boundary folding methods.

There are basically two types of folding method in the hashing that are:

  • Folding shift
  • Folding boundary

In the folding boundary method the outside value are get reversed and the alternate values are get flipped at the boundary folding method.

4 0
3 years ago
Refer to the color wheel to identify the color scheme.
morpeh [17]
C) monochromatic
Hope this helps!

btw make me brainliest?
4 0
3 years ago
Which type of data is most sensitive and should be protected from malware?
Dennis_Churaev [7]
The correct answer is “C. The credit card number that you use to make an online purchase”
5 0
1 year ago
Aniyah is setting up a group of computers in her office that will share several devices. Which type of operating system should s
jenyasd209 [6]

Answer:

B

Explanation:

the software needs to share thus should be networked

8 0
2 years ago
Other questions:
  • Which of the following is a true statement about psychological tests administered by computers? computers make standardization e
    9·1 answer
  • When does state law require drivers to use their headlights (6)
    11·2 answers
  • Dylan, an interior designer, has sketched out a layout for a client's living room. He wants the client's approval of the layout
    11·2 answers
  • Why does the phrase "compatibility mode” appear when opening a workbook?
    6·2 answers
  • How is a correction made to an Electronic health record?
    14·1 answer
  • You want to boot a linux system into singer user mode/ what options might you add to a linux kernel options list in a boot loade
    9·1 answer
  • One common method of converting symbols into binary digits for computer processing is called ASCII​ (American Standard Code of I
    5·1 answer
  • What are 6 steps to take to figure out what's wrong with your computer?
    5·1 answer
  • Which of the following tools helps ensure your document will open in older versions of word
    13·1 answer
  • The international system of units is very important to our worldwide science community because it is easier for scientists to sh
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!