Question: python Write a program which reads a positive integer n and print out all the factors k where kis larger than 1 and less than
Write a program which reads a positive integer n and print out all the factors k where kis larger than 1 and less than k. Use for-loops in this program. (hints: if n is a factor of k, the remainder of n/k should be equal to zero. Which operator in Python will give us the remainder of a division?) Input Output Case 1 12 2 3 4 6 7 2 . 3 -1 30 Error: Negative number 2 3 5 6 10 15 4 Modify the program in Q.1 such that it prints the number of factors for a positive input number. You should also handle error cases as shown in the following examples. Input Output Case 1 12 4 2 2 0 3 3 -3 Error: Negative number
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
