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
4. What is the connection between productivity and Microsoft Office/ Office 365?
ikadub [295]
Microsoft 365 plans for home and personal include the robust Office desktop apps that you're familiar with, like Word, PowerPoint, and Excel. ... Office 2019 is sold as a one-time purchase, which means you pay a single, up-front cost to get Office apps for one computer.

Hope this helps :)
3 0
2 years ago
Q1: what is significant about the contents of the destination address field?
Stells [14]
<span>The destination address field must contain the MAC address.
The MAC address is needed to help find a device for an ARP request.</span>
All hosts on the LAN will receive this broadcast frame. The host with the IP address of 192.168.1.1 (default gateway) will send a unicast reply to the source (PC host). This reply contains the MAC address of the NIC of the Default Gateway.
5 0
3 years ago
Read 2 more answers
What are the guided and unguided transmission media and what are the differences?
Ludmilka [50]

Answer:  They are forms of of carrying data from communication devices. The difference is the medium where the signal travels.

Explanation:

Hi, the difference between guided and unguided media is that in the guided media, the signal travels through a physical medium whereas, in unguided media, the signal travels through the air.  

Guided and unguided media are types of transmission media.

The transmission media carries electromagnetic signals, that transmit data between communicating devices like computers.

4 0
2 years ago
When typing an outline, you can move a point from a lower level to a higher level by changing the list level from the outline me
Arte-miy333 [17]
A shift+Tab
I hope it’s work
6 0
2 years ago
Each time the enter key is pressed, word creates a new paragraph. (points : 2) true false
ludmilkaskok [199]
Your answer would be true
6 0
2 years ago
Other questions:
  • 3. Megan and her brother Marco have a side business where they shop at flea markets, garage sales, and estate
    9·1 answer
  • Over the past week, every time Larry has started his computer, he has noticed that the time is not correct. Larry didn’t conside
    13·2 answers
  • _____ is a subset of a data warehouse in which only a focused portion of the data warehouse information is kept. A. Data diction
    6·1 answer
  • The two principal catalysts for the Information Age have been:________.
    15·1 answer
  • Consider the following constructor for an immutable matrix ADT:
    8·1 answer
  • A reference parameter differs from an output parameter in that a reference parameter ______________________ but an output parame
    5·1 answer
  • Janet received an email from a bank asking for the password for her Internet banking account. She emailed back her password. A f
    12·2 answers
  • Consider the method get Hours, which is intended to calculate the number of hours that a vehicle takes to travel between two mil
    6·1 answer
  • This feature in Word Online allows you to view your document to see what it will look like when printed.
    6·2 answers
  • Unscramble the given word and identify the correct statement about it. ATTEPLSR
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!