Ask Question
1 July, 23:33

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.

+1
Answers (1)
  1. 1 July, 23:51
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers