Program to print all prime factors of a given number
Problem
Given a number n, write an efficient function to print all prime factors of n. Example
For example, if the input number is 12, then output should be “2 2 3″. And if the input number is 315, then output should be “3 3 5 7″.
Following are the steps to find all prime factors.
1) While n is divisible by 2, print 2 and divide n by 2.
[Read More]