Here is the C# Solution to find the factors of given number:

– To improve the Performance of finding Factors of a given **Odd** number, we can increment **i** in the **for** loop by 2 instead of 1.

public ListfindFactors(int n) { List factors = new List (); int max = Convert.ToInt32(Math.Sqrt(n)); for (int i = 1; i <= max; i++) { if(n % i == 0) { factors.Add(i); if(i != max) // add square-root factors only once. factors.Add(n/i); } } return factors; }