how to get the factors of a product
<p>I am trying to write a piece of code that will take the number let's say 24 and get all the factors for it so it would print the numbers 1 and 24, 8 and 3, etc. I tried doing this myself however I am fairly new to using c++ so it kind of confuses me a little. I apologize if this is really easy or simple to answer. could you please show me how this could be done?</p>

<pre><code>int y = 0;
int x = 0;
int product = x * y;

while (true)
{
    product = x * y;
    x++;
    y++;
    if (product == 24)
    {
        cout &lt;&lt; x &lt;&lt; " " &lt;&lt; y &lt;&lt; endl;
    }
}
</code></pre>

<p>that is the code I tried doing it with but I realized that since x and y are increasing at the same time it will never reach 24 as a product.</p>
