## Finding all the factors of a given number

Given a number, how do we write a program to find all of it’s factors or divisors. For example, for the number 18, the factors are {1, 2, 3, 6, 9, 18}. An immediate algorithm that comes to our mind is to run a loop from 1 to n. In each iteration check if the…