Ask Question
30 June, 03:24

Write a function to find the factors of an input number. The function should have one input n and a single output of a vector whose entries are the factors of n. The only built in functions you are allowed to use are mod or rem (I would prefer mod). Demonstrate that your function works as expected.

+4
Answers (1)
  1. 30 June, 03:35
    0
    The following is the program.

    Explanation:

    We should find the factors of input number We can use python to find the factors of input number In this program, we can use the mod function.

    def print_factors (y):

    print ("The factors of", y,"are:")

    for j in range (1, y + 1):

    if y % j = = 0:

    print (j)

    num = 320

    print_factors (num)

    The above program calculates the factors of n. Here def is called as define function. We are calculating the factors of y. After that, we are giving them for the condition. If the condition is true it will print the factors of y.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a function to find the factors of an input number. The function should have one input n and a single output of a vector whose entries ...” in 📗 Engineering if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers