# Stuck on a programming problem

• 09-21-2012
Phil Schroeder
Stuck on a programming problem
Hi all just was looking for a bit of advise on a program assignment I
have and am stuck on. Not asking you to do the whole thing just am wondering how to go about writing the mathematical portion of the program. here it is

Find the difference between numbers with an odd number of factors and numbers with an even number of factors for all numbers greater than one and less than one million.

1. use a conditional operator within a cout statement to determine whether to output the (odd factors) - (even factors) or(even factors) - (odd factors) so as to print to the console a positive difference between the two numbers,
2. use a for loop that sequentially tests for factors starting at 1 and ending when the loop counter exceeds the number being considered.
3. use output formatting to display the final output field seven characters wide,
4. use a "const unsigned int" to store the parameter MAX_VALUE, which indicates the upper limit of numbers being considered,
5. use increment and decrement operators when your algorithm's logic is incrementing or decrementing variables,
6. use at most one while loop, one for loop, and one do-while loop
7. output only the result using the specific format:
The difference between numbers with odd factors and numbers with even factors is xxxxxxx.<cr>
where "xxxxxxx" represents the seven-digit-wide output field for your answer, which must be a positive value as per item #4 above.