python Factoring of integers. Write a program that asks the user for an integer and then prints out all its factors. For example, when the user enters 150 (which equals 2 * 3 * 5 * 5), the program should print: The factors of 150 are: 2 3 5 5

Answers

Answer 1

Answer:

Written in Python:

num = int(input("Number: "))

i = 2

print("The factors of "+str(num)+" are ",end='')

while num > 1:

     if num%i == 0:

           num = num/i

           print(str(i)+" ",end='')

           i = 2

     else:

           i = i + 1

Explanation:

This line prompts user for input

num = int(input("Number: "))

This line initializes divisor, i to 2

i = 2

This line prints the literal in quotes

print("The factors of "+str(num)+" are ",end='')

The following while loop checks for divisor of user input and prints them accordingly

while num > 1:

     if num%i == 0:  This checks for factor

           num = num/i  Integer division

           print(str(i)+" ",end='')  This prints each factor

           i = 2  This resets the divisor back to 2

     else:

           i = i + 1

Answer 2

The program that asks the user for an integer and then prints out all its factors is represented as follows:

x = int(input("please input an integer: "))

for i in range(1, x+1):

  if x%i == 0:

     print(i)

The first line of code ask the user to input the integer number.

Then we loop through the the range of 1 to the inputted integer plus one.

The integers is then divided by the looped numbers . if it has no remainder then it is a factor.

Finally, we print the factors.

learn more about python here; https://brainly.com/question/17184408?referrer=searchResults


Related Questions

Critical Thinking 5-1: DoS Attacks Denial of service (DoS) attacks can cripple an organization that relies heavily on its web application servers, such as online retailers. What are some of the most widely publicized DoS attacks that have occurred recently (within the last two years)

Answers

Explanation:

The DDoS attacks occur when a bad actor bombards an online network or service with very large amounts of traffic in an effort to overwhelm the network and then disrupting the services from their full operation.

Some of the most widely publicized DoS attacks that have occurred recently include:

The AWS (Amazon Web Services) DDoS Attack occurred in February 2020.The GitHub DDoS attack which occurred in February 2018.The Dyn DDoS attack which occurred in October 2016.

Write a function, named series_of_letters, that takes a reference to a vector of chars and returns nothing. The function should modify the vector to contain a series of letters increasing from the smallest letter (by ASCII value) in the vector. Note, the vector should not change in size, and the initial contents of the vector (excepting the smallest letter) do not matter.

Answers

Answer:

Follows are the code to this question:

#include <iostream>//defining header file

#include <vector>//defining header file

#include <algorithm>//defining header file

#include <iterator>//defining header file

using namespace std;//use namespace

void series_of_letters(vector<char> &d)//defining a method series_of_letters that accept a vector array  

{

char f = *min_element(d.begin(), d.end()); //defining a character array  that holds parameter address

   int k = 0;//defining integer vaiable  

   std::transform(d.begin(), d.end(), d.begin(), [&f, &k](char c) -> char//use namespace that uses transform method  

   {

       return (char)(f + k++);//return transform values

   });  

}

int main() //defining main method

{

   vector<char> x{ 'h', 'a', 'd' };//defining vector array x that holds character value

   series_of_letters(x);//calling series_of_letters method

   std::copy(x.begin(),x.end(),//use namespace to copy and print values

           std::ostream_iterator<char>(std::cout, " "));//print values

}

Output:

a b c

Explanation:

In the above code, a method "series_of_letters" is defined that accepts a vector array in its parameter, it uses a variable "d" that is a reference type, inside the method a char variable "f" is defined that uses the "min_element" method for holds ita value and use the transform method to convert its value.

Inside the main method, a vector array "x" is defined that holds character value, which is passed into the "series_of_letters" to call the method and it also uses the namespace to print its values.

How did the advertising company know he was interested in those shoes? Or in that store?

Answers

Answer:

Because they have ads based on what you search most

Explanation:

Credible sites contain___________information,
a.
Accurate
c.
Reliable
b.
Familiar
d.
All of the above


Please select the best answer from the choices provided

A
B
C
D

Answers

Answer:

C:  Reliable

Explanation:

Credible sites are not always accurate. Credible sites are sites you trust and usually have a resume of being correct.

For example, if you like a news website that you trust and are usually correct, you could say that's a Reliable source.

Credible sites contain "accurate, reliable and familiar" information. this makes the correct answer D: All of the above.

What are Credible sites contain?

A Credible sites includes the date of any information, cite the source of the information presented, are well designed and professional.

Some example of credible site are; the site of an university , while a non-credible site is a site that wants to sell you something by sending you repeated email.

A Credible sites are not always accurate

Also, Credible sites are sites you trust and usually have a resume of being correct.

Hence Credible sites contain "accurate, reliable and familiar" information. this makes the correct answer D: All of the above.

Learn more about the similar question;

https://brainly.com/question/3235225

#SPJ2


PLS ANSWER ASAP
——————————————



Question 2 (1 point)
What function would you use to find the most popular video?
Max
Average
Sum
Count
Min

Answers

Count explanation: I don’t really know how to explain it hope it helps:)

Answer:

Count

Explanation:

Because most popular vidoes need a count of viewers to determine how popular it is. Think of it like the cliche bar chart sued to determine what is the most popular ice cream flavor. A computer could anaylse this data and count each reponse to see what flavor had the most responses. Hope this helps! Let me know if you need more info!  

Which command displays various pieces of information about the current IOS version, including the licensing details at the end of the command's output

Answers

Answer:

The show version command

Explanation:

It is the show version command that display various pieces of information about the current IOS version, including the licensing details at the end of the command’s output.

This command is an example of a command that can be used to gather information about the current IOS version running on the given router.

It also has the capability of giving several other manufacturing information about the router in question. Summarily, it helps to give information about details related to the hardware present (e.g memory) and the software (e.g IOS version of the router)

what is the importance of ICT in agriculture​

Answers

Answer:

ICT helps in growing demand for new approaches. It also helps in empowering the rural people by providing better access to natural resources, improved agricultural technologies, effective production strategies, markets, banking and financial services etc.

Explanation:

ICT helps in growing demand for new approaches. It also helps in empowering the rural people by providing better access to natural resources, improved agricultural technologies, effective production strategies, markets, banking and financial services etc.

Write a C program which dynamically allocates memory to define an integer array with the length 15 by using the calloc function. Do not forget to free the memory in the end of your program. What happens if you attempt to print your string before and after freeing memory

Answers

Answer:

When you try to print values from the array before setting free the memory previously allocated, it will return values that were inserted while runtime.

For this it is used the calloc, that is a function of the stdlib.h library, of the C programming language. Its objective is to create a vector of dynamic size, that is, defined during the execution of the program. It differs from the malloc function, also from C, because in addition to initializing the memory spaces, it also assigns the value 0 (zero) to each one. It is useful, because in C when a variable is declared, the space in the memory map used by it probably contains some garbage value.

Code:

#include <stdio.h>

#include <stdlib.h>

int main()

{

   int* ptr;

   int n, i;

   n = 15;

   ptr = (int*)calloc(n, sizeof(int));

   if (ptr == NULL) {

       printf("\n Memory is not allocated");

       exit(0);

   }

   else {

       printf("\n Memory allocated");

       for (i = 0; i < n; i++) {

printf("\n Input value in the array at position %d: ",i);

scanf("%d",&ptr[i]);

       }

      printf("\n The elements of the array are: ");

       for (i = 0; i < n; i++) {

           printf("%d, ", ptr[i]);

       }

free(ptr);

   }

return 0;

}

Kelsey noticed one of the new employees at her job is struggling with the amount work assigned to her. What can Kelsey do to support her co-worker?

A: Complete the work for her co-worker.
B: Offer to help her co-worker.
C: Ignore her co-worker. It's none of her business.
D: Document it, then tell her manager.

Answers

Answer:B. Offer to help her co-worker.

Explanation: She can help, but A, meaning she would do all the work for her co-worker and Kelsey not get paid.

B is the best option!

-AW

Answer: B offer to help her co-worker.

Explanation:

Just trust me I did the test.

You are doing a multimedia presentation on World War I, and you want to use a visual aid to show the battle areas. What visual aid is best suited for this purpose?

Answers

Answer:

Map

Explanation:

I put it in on Edg and got it correct, hope this helps :)

Answer:

The correct answer is map

Explanation:

I just did the assignment on edge 2020 and got it right

At which point should a user select the option to make a delegate aware of permissions?
in the message body after selecting the recipient
after configuring the permissions in the dialog box
before assigning the permissions in the delegate dialog box
in the user’s contact information by clicking Send Permissions

Answers

Answer:

after configuring the permissions in the dialog box

Explanation:

Answer:

B) after configuring the permissions in the dialog box

Explanation:

Just got it right

3.5) BEST ANSWER BRAINLIEST
your answer will be reported if it is ridiculous

Which of the following are parts of the Physical Layer?


connectors

pins

cables

pointers

Answers

Answer:cables

Explanation:

Answer:

Cable And Connectors

Explanation:

What goes in the red blanks?

Answers

Answer: In the middle you would put the definition or meaning, on the right side you would put the code, on the left side you would put the code in between </    >.

Explanation:

write a program that implements a simple movie selection decision tree. The decision tree will help the user determine which Dwayne Johnson movie to see.

Answers

Answer:

In order to make the following code in C it is necessary to take in consideration the possible tree of choices, or decision make trees.

Code:

#include <stdio.h>

int main(){

       printf("Please answer with (y/n) \n");

       printf("How about comedy movies?  ");

       char optional[2];

       scanf("%s",&optional);

       if(optional[0] == 'y'){

               printf("Recommended: CENTRAL INTELLIGENCE\n");

       } else if(optional[0] == 'n'){

               printf("Then, how about a current movie ?  ");

               scanf("%s",&optional);

               if(optional[0] == 'y' ){

                       printf("Recommended: HOBBS & SHAW\n");

               }else if(optional[0] == 'n') {

                       printf("how about electronic games ?  ");

                       scanf("%s",&optional);

                       if(optional[0] == 'y' ){

                               printf("Certified Fresh ?  ");

                               scanf("%s",&optional);

                               if(optional[0] == 'y'){

                                       printf("recommended JUMANJI : WELCOME TO THE JUNGLE\n");

                               }else if(optional[0] == 'n') {

                                       printf("RAMPAGE");

                               }

                       }else if(optional[0] == 'n') {

                               

                               printf("about franchises ?  ");

                               scanf("%s",&optional);

                               if(optional[0] == 'y'){

                                       printf("Recommended: FAST FIVE\n");

                               }else if(optional[0] == 'n') {

                                       printf("How about animation ?  ");

                                       scanf("%s",&optional);

                                       if(optional[0] == 'y'){

                                               printf("recommended: MOANA\n");

                                       }else if(optional[0] == 'n') {

                                               printf("recommended: SKYSCRAPPER\n");

                                       }

                               }

                               

                       }

               }

       }        

       return 1;

}

What is the smallest value that can be written to the address of the LED array in order to turn on all 8 LEDs

Answers

Answer:

0xFF

Explanation:

0xff is a computer programming character which is the hexadecimal number FF that has an integer value of 255. It is represented as a binary in 00000000000000000000000011111111 (under the 32-bit integer).

In this case given that 0xFF has a one (1) in bits 0 to 7, thus representing the value, 0xf01000ff, will turn on all 8 LEDs.

Hence, the correct answer is "0xFF"

Write a function biggestAndRest that accepts one argument---a list containing integers. biggestAndRest should then return a tuple with two items: (1) the largest integer in the original list and (2) a nested tuple containing the rest of the items in the original list. For example, biggestAndRest([3,1,4,2]) should return (4, (3,2,1))

Answers

Open your python console and execute the following .py code.

Code:

def biggestAndRest(lis):

   mxE = max(lis)

   maxIdx = lis.index(mxE)

   l2 = lis.copy()

   l2.pop(maxIdx)

   return mxE,tuple(l2)

r = biggestAndRest([3,1,4,2])

print(r)

Output

(4, (3, 1, 2))

Discussion

From [3,1,4,2] it became (4, (3, 1, 2))

following the principle of the function biggest and rest

What is the best reason a student should cite an online source for a school report?

It demonstrates the credibility of the online source.
It shows the student wants to get a good grade.
It shows the student was interested in the topic.
It demonstrates the length of time it took to write the report.

Answers

Answer:

A

Explanation: B and C are easy to cross off, as they aren't related strictly to citing your sources. D doesn't make sense because anything can be cited in any amount of time. The answer is A.

Answer:

it demonstrates the credibility of the online source for a school report

Explanation:

What is a popular method used to address or remove the requirement for no-preemption for deadlock prevention:

Answers

Answer:

Hello the options related to your question is missing below are the missing options

A)  Process termination

B)  Mutual exclusion

C)  Rollback or check-pointing mechanisms

D)  None of these are methods used to address no-preemption

answer : Process termination ( A )

Explanation:

The popular method used to address or remove the requirement for no-preemption for deadlock prevention is called  Process termination.

Process termination is a process/method used for the termination of a process even before they are commenced especially in the prevention of a  deadlock situation

while Mutual exclusion prevents the access to a shared source concurrently

Question #1
Dropdown
Identify the type of data for each value below.

12.023
O string
O float
O int

‘Hello World’
O string
O float
O int

52
O string
O float
O int

Answers

Answer:

12.023 : float

'Hello World' : string

52 : int

Explanation:

Edg2021

A PC that is communicating with a web server has a TCP window size of 6,000 bytes when sending data and a packet size of 1,500 bytes. Which byte of information will the web server acknowledge after it has received two packets of data from the PC

Answers

Answer: 3001.

Explanation:

The Server would acknowledge the 3001 information after it receives two packets of data from the personal computer, which is being used to communicate with the web server of the TCP (Transmission Control Protocol) with a window of 6000.

A TCP is the defined standard which is used for establishing and maintaining a network conversation. this is a medium from which applications programs exchange data.

The TCP is explicitly called the Transmission Control Protocol which allows computing devices to communicate and exchange information by sending packets over a network. Hence, the byte of information acknowledged after receiving 2 packets of data is 3001.

Size perpacket data = 1500 bytes Number of packets sent = 2

The bytes of information acknowledged by the web server can be calculated thus :

Size per packet data sent × number of packets

1500 × 2 = 3000

Therefore, the bytes of information that would be acknowledged by the web server is 3001.

Learn more : https://brainly.com/question/12191237

Other Questions
A mover lifts a 12-kg box straight up 1.5 m. How much work is done on the box? Accounts Balances Accounts Balances Cash $ 40,000 Common Stock $ 50,000 Accounts Receivable 50,000 Retained Earnings 35,000 Supplies 1,100 Dividends 1,100 Prepaid Rent 3,000 Service Revenue 65,000 Equipment ? Salaries Expense 30,000 Accounts Payable 17,000 Rent Expense 12,000 Salaries Payable 5,000 Interest Expense 3,000 Interest Payable 3,000 Supplies Expense 7,000 Deferred Revenue 9,000 Utilities Expense 6,000 Notes Payable 30,000 Required: Prepare a trial balance by placing amounts in the appropriate debit or credit column and determining the balance of the Equipment account. what is the first step to solving multiple step equations? Write a paragraph about how the competition between the 2nd and 3rd estate caused the French Revolution what is 6units to the right of -1 is HELP I NEED AN ANSWER FASTTriangle ABC is transformed to triangle ABC, as shown below:Which equation shows the correct relationship between the measures of the angles of the two triangles? The measure of angle CAB = The measure of angle C prime B prime A prime The measure of angle BCA = The measure of angle A prime B prime C The measure of angle CAB = The measure of angle C prime A prime B prime The measure of angle BCA = The measure of angle C prime A prime B prime Joelle is a manager at a construction company, and she is interested in the chemistry behind the materials they use. She has begun studying the materials used to fill walls. She knows that to keep the temperature inside a room steady the material must be a thermal insulator, and she predicts that materials should not be acidic or else they would dissolve too easily in water.Which of these is a molecular ingredient that could be used in a wall-filling material ?C6H6Na6Ba6NeNaHCl HELP PLEASE. FIRST PERSON WHO ANSWERS CORRECTLY GETS BRAINLIEST!!!!!!!!! When serving in pickle-ball, the serve must be underhand and below the waistline. True or false? Item 18 The distance between Cleveland, Ohio, and St. Louis, Missouri, is 3 miles less than 2 times the distance between St. Louis and Chicago, Illinois. Let d be the distance between St. Louis and Chicago. Which expression can you use to represent the distance between Cleveland and St. Louis? I will give u the brinlist if the answer is right Lin read for x minutes, and Elena read for 5/8 more than that. Write an expression for the number of minutes Elena read. Only use decimals in your expression. The planet Mercury is roughly 2 5 the size of Earth. The planet Jupiter is 2.5 times the size of earth. Earth is 3,959 miles. How much larger is Jupiter than Mercury? Write your answer as a decimal. Please upload a photo of your work. A girl falls off her bike and breaks a bone in herleg. The bone can be seen poking through theskin. X-rays show that the bone is broken into twopieces. Which words best describe this kind ofbreak?simplecompoundincompletecomplete how did Virginia's owner try to attract settlers to The Colony.A- with payment of goldB- with promises of marriage C- by giving the headrightsD- by offering religious freedom To the nearest hundredth, 0.80.6 is about...Please help! Help please i am not sure bout this In which pair do both decimals represent rational numbers?O A. 2.71828182845904523536... and 0.1222O B. 3.141592653589793238... and 0.684O C. 3.141592653589793238... and 0.1222...O D. 0.684 and 0.1222... To determine the theme of a story, the reader must studyA. the first and last paragraphs of the story.B. what the characters say to each other in the story.C. the characters problem in the story and how it is resolved.D. where the action of the story takes place and why thats important. What are some things that you can do to reduce your impact on desertification?