Ask Question
14 December, 03:11

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. 14 December, 06:09
    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 you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers