How to increment numbers by five in a for loop
<p>Hi so I am using C code and trying to create a table where the number gets incremented in multiples of 5 starting from 1 to 5 to 10 to... all the way until the user's input. What I've gotten so far is that it starts at 1 and then increases the number by 5 like 1 to 6 to 11 to 16... until it gets to where it can't increase the number by 5 anymore without going above the user's input. Could someone help me set up the for loop better?</p>

<p>Here's the segment of my code I'm talking about:</p>

<pre><code>else //run this statement if the user inputs a number greater than 14
    {
        printf("Number   Approximation1         Approximation2\n-----------------------------------------------------\n"); //prints the header for second table

        for ( i = 1; i &lt;= n; i += 5 )
        {
            printf("%d        %e            %e\n", i, stirling1( i ), stirling2( i )); //calls functions to input approximate factorials
        }
    }
</code></pre>

<p>So with this code if I input n as 28, I get i to increment from 1 to 6 to 11 to 16 to 21 to 26.</p>

<p>What I want the code to do if I input n as 28 is increment i from 1 to 5 to 10 to 15 to 20 to 25 to 28.</p>

<p>Thanks in advance!</p>