Solution for Exercise 9-6

ex0906

#include <stdio.h>

int main()
{
    int tre;

    for(tre=3;tre<=100;tre=tre+3)
    {
        printf("%d\t",tre);
    }
    putchar('\n');
    return(0);
}

Output

3     6     9    12    15    18    21    24    27    30    3
3    36    39    42    45    48    51    54    57    60    6
3    66    69    72    75    78    81    84    87    90    9
3    96    99

Notes

* As with Exercise ex0906, output above reflects wrapping a single line of text on a typical 80-column output window.

* A correct solution for this Exercise could include only modifications to Line 7, changing the first and third parts of the for statement. I went a step further and changed the variable duo to tre.

* You did not need to change the center value from 100.