answer.
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
GrogVix
2 months 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:
Rzqust [1K]2 months 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 information is helpful!
You might be interested in
for question 1-3, consider the following code what is output if the user types in 9? click all that apply A, B, C, D click all t
oksian1 [950]

Response:

weyfbhy

Clarification:

8 0
2 months ago
On the planet Sigma, robots excavate chunks of a very precious cristaline. These chunks can be divided into smaller part only on
Amiraneli [1052]

Answer:

Begin the algorithm by assessing the ship's weight. Load the crystalline material onto the ship. Verify if the weight equals the ship's weight plus k pounds of crystalline; if it is not enough, load additional crystalline. If there is an excess, discard the surplus crystalline. Upon meeting the required weight, the ship can depart for planet Sigma.

Explanation:

The algorithm consistently monitors the ship's weight while loading with the total of the ship's weight along with k pounds of crystalline. This method ensures that the ship carries the maximum feasible amount of crystalline to planet Sigma.

7 0
2 months ago
On January 1, 1980, Moises deposited $1850 into a savings account paying 5.6% interest, compounded quarterly. If he hasn't made
Natasha_Volkova [1026]
According to the rule of 72, dividing 72 by the interest rate gives the time needed to double your investment. With an interest rate of 5.6%, we calculate 72/5.6 = 12.86 years. Thus, to increase the amount from $1850 to $3700, it would take approximately 12.86 years, suggesting that by late 1992 the balance would reach $3700.
8 0
1 month ago
Read 2 more answers
Which of the following attributes of a website indicates a more reliable source for information?
amid [951]
A characteristic of a website that signifies a more trustworthy source of information is when it has a domain ending in ".edu". This top-level domain is associated with educational institutions, indicating that the site is connected to universities, colleges, or other educational entities, thus providing reliable and factual information.
3 0
1 month ago
Anna is making a presentation on the top five most visited cities in her state. she wants to make sure that she does not put in
Harlamova29_29 [1022]
Outline View. This mode displays solely the text of all slides on the left side, allowing Anna to determine if she has included too much or too little content on each slide.  She can also edit the text directly while simultaneously observing its impact on the slide.  
8 0
1 month ago
Read 2 more answers
Other questions:
  • Tag groups can be nested up to ____ levels deep, with up to _______ tag subgroups under a single parent.
    14·1 answer
  • Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 3 8 the output is
    5·1 answer
  • (Java)Write a program that calculates and displays the conversion of an entered number of dollars into currency denominations—20
    11·1 answer
  • A wireless network does not benefit like a wired network does, when it comes to collision reduction. Which device reduces collis
    6·1 answer
  • Team A found 342 errors during the software engineering process prior to release. Team B found 184 errors. What additional measu
    12·1 answer
  • Write a Scheme predicate function that tests for the structural equality of two given lists. Two lists are structurally equal if
    13·1 answer
  • Write a statement that defines an ifstream object named inputFile and opens a file named "Friends.txt".
    13·1 answer
  • Write a method named removeDuplicates that accepts a string parameter and returns a new string with all consecutive occurrences
    7·1 answer
  • A company has deployed four 48-port access layer switches to a switch block. For redundancy each access layer switch will connec
    14·1 answer
  • What is the purpose of using self.id in tests, while working with unittest?A. self.id returns the name of moduleB. self.id retur
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!