Program
22
C++
To find if a number (call it factor) is a divisor of another (call it num), we used the C++ if comparison and MOD the %…
If (num % factor = = 0)
This will result in zero if you get no remainder with division.
Using a for loop, find all the factors and count how many there are for some user input number.
Like this…
Please enter your number: 48
FACTORS ARE { 48, 24, 16, 12, 8, 6, 4, 3, 2, 1 } 10 Factors for 48
Hint: Have your loop start at NUM down-to ONE, decrementing as it loops. Use the % as above to determine divisibility (= = 0, then print it)
Even if our efforts
of attention seem for
years to be producing
no result, one day a
light in exact
proportion to them will
flood the soul.
-- Simone Wiel (exerpt from THE LITTLE ZEN COMPANION )
If my heart can become
pure and simple like that
of a child, I think there
probably can be no greater
happiness than this.
-- Kitaro Nishida
(exerpt from The Little Zen Companion )