Design an algorithm to ?nd all of the factors of a positive integer.just outline?
Style an formula to nd each of the factors of any positive integer.
Let’s point out the int will be num.
Let div be the test divisor, one more word intended for factor
when num%div is equal to zero after that div is usually a factor.
Consequently, just write a loop to increment div by way of 1 through 1 to be able to num
for( int div = 1; div<=num; div++ )
…if( num PERCENT div == 0 ) // div Is usually a factor
Be aware that ONE and num usually are always divisors involving num, except num is zero!
Leave a Reply
You must be logged in to post a comment.