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
1 punto
masya89 [10]

Answer:

Retailing.

Explanation:

La venta al por menor o retailing es el suministro de bienes físicos a los consumidores para uso personal, sea en pequeña o grandes cantidades, siempre que esté destinado a consumidores finales. Es un sector que consta de diferentes ramas (como la industria alimentaria, la industria de la moda, la industria del mobiliario para el hogar, etc.). El comercio minorista es el último eslabón de la cadena de suministro que va desde el fabricante hasta el consumidor.

4 0
3 years ago
You have a website that sells widgets, and you have a category page specifically for blue widgets. After some extensive outreach
REY [17]

Answer:

It will increase your ranking on the homepage.

Explanation:

Widgets are easy to use software applications made up of one or more components.

Widgets will provide you with a quick access to information or data and there won't be any need to open the app that manages that information.

That is to say, without requiring you to open the app that manages a certain data or information you want to access, Widgets opens it for you.

For instance, The Calendar widget, provides you a quick view of your upcoming calendar events without opening the Calendar app.

Your rankings on the homepage will increase if more links are added to your blue widgets.

7 0
3 years ago
In which job role would a course in 3D modeling help with professional career prospects?
shutvik [7]
The correct answer would be a Multimedia Artist, seeing that you will be designing various models for animations, computer games, etc.
5 0
4 years ago
Read 2 more answers
Write a Short note on Importance of being a good child​
marysya [2.9K]

Answer:

<em><u>Understand that people are learning from you in ways that you may never know. Other people need you to be human to the fullest. More importantly, you need yourself to be human to the fullest. When you make mistakes, take responsibility and learn from them.</u></em>

8 0
3 years ago
Read 2 more answers
What is library function? list any three library function​
attashe74 [19]

Answer:

Library Functions: Library functions are the ones which are predefined functions.

Explanation:

Library Functions must be used along with the appropriate header files .

Header files contains the signature of library functions.

Using these functions it reduces the time of the programmer .

List of some library Functions:(in C Language)

  1. printf()
  2. scanf()
  3. sqrt()
  4. strcpy()
  5. strcmp()

7 0
3 years ago
Other questions:
  • You need to immediately terminate process id 2129. which command should you use?
    15·1 answer
  • A type of bridge that relies on a curved, semi-circular structure for support
    5·1 answer
  • In 1-2 sentences describe how to use the thesaurus in the Word Processor
    11·2 answers
  • GAMES Which is better Roblox or BattleCamp Basically Free Points But Please Answer
    7·2 answers
  • Which two options are negotiated via ncp during the establishment of a ppp connection that will use the ipv4 network layer proto
    7·1 answer
  • Which type of network involves buildings in multiple cities connecting to each other?
    8·1 answer
  • Your dad just gave you his old computer running Windows 7. You want to see how many volumes are contained within it. Which tool
    10·1 answer
  • What is the Microsoft excel window where you work on. And it composed of three worksheet?​
    7·1 answer
  • A person interested in a career in digital media should have which qualities? Select all that apply.
    13·1 answer
  • What is the best approach to testing a website? visit all pages to verify that they load visit every page and verify all links v
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!