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
To comply with ATC instructions for altitude changes of more than 1,000 feet, what rate of climb or descent should be used?
jasenka [17]

Answer:

B

Explanation:

5 0
3 years ago
Which of the following is NOT a career in the Information Support and Services pathway?
frosja888 [35]

Answer:

here yuuuurrrrr Vote for me nah jk

6 0
2 years ago
How does the medium affect the amplitude of sound?
Ratling [72]

The amplitude of a sound energy depends upon the how much energy we are giving to the wave or how much compression on the wave is taking place.

It does’t depends upon the wave length,frequency


7 0
3 years ago
What is an audit trial
Nastasia [14]

Hi there!

A audit trial is a report of changes that have been obtained to a file or some kind of database.

Hope this helped!~

7 0
3 years ago
Ram and hard disks are both forms of data storage. How are they alike? How are they different? In particular, discuss the relati
saw5 [17]

solution:

RAM takes the form of computer chips — integrated circuits — that are either soldered directly onto the main logic board of your computer, or installed in memory modules that go in sockets on your computer’s logic board.

RAM stands for Random Access Memory. The data stored in RAM can be accessed almost instantly regardless of where in memory it is stored, so it’s very fast – milliseconds fast. RAM has a very fast path to the computer’s CPU, or central processing unit, the “brain” of the computer which does most of the work.

Computers need some form of non-volatile storage: A place data can stay even when the computer isn’t being used, so you don’t have to reload and re-enter everything each time you use the computer. That’s the point of having storage, in addition to RAM.

Storage for the vast majority of computers in use today consists of a hard disk drive. Hard drives can provide hundreds or thousands of gigabytes of space that can be used to store applications, documents, data and all the other stuff you need to get your work done

Storage is slower than RAM. Hard disk drives are mechanical devices, so they can’t access information nearly as quickly as memory does. And storage devices in most personal computers use an interface called Serial ATA (SATA), which affects the speed at which data can move between the drive and the CPU.

They affects our computer by these ways

RAM, the most serious bottleneck to improving performance in your computer can be your storage. Even with plenty of RAM installed, computers need to write information and read it from the storage system – the hard drive or the SSD.

Hard drives come in different speeds and sizes. Many operate at 5400 RPM (their central axes turn at 5400 revolutions per minute). You’ll see snappier performance if you can get a 7200 RPM drive, and some specialized operating environments even call for 10,000 RPM drives. Faster drives cost more, are louder and use more power, but they exist as options.


3 0
3 years ago
Other questions:
  • A class car and its subclass bmw each have a method run(), which was written by the developer as part of the class definition. i
    10·1 answer
  • Which of the following is a true statement? Question 33 options: Data entities correspond to sources/sinks on a data flow diagra
    14·1 answer
  • Which are benefits of modeling a solution? Choose all that apply. allows you to be sure the problem and solution are understood
    9·2 answers
  • Robin ensures that she is always available if anyone in the team needs her. Which quality is shown by robin?
    9·2 answers
  • Wireless attacks avoid the access points to limit detection. <br> a. True <br> b. False
    9·1 answer
  • Think of a recent occasion when you became upset with a friend or family member. How did you handle the situation? How did you c
    8·1 answer
  • A bubble starts by comparing the first item in the list to all the remaining items, and swaps where the first item is ____ a lat
    9·2 answers
  • Website designers work on the code and programming of a website, not the style or layout of the site.
    9·1 answer
  • Is Invader Zim gonna come back?
    7·1 answer
  • A(n) ________ is a wonder of miniaturization combining a CPU, GPU, and sundry other support logic onto a single silicon die, sav
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!