A more efficient means of checking for an even number would be

division by 2 with the mod operator (%). This will return the

remainder of a number divided by another. For example:

Code:

int iNum1 = 20;
int iNum2 = 2;
int iResult = 0;
iResult = iNum1 % iNum2;
// iResult will equal zero

Just put this logic into a conditional statement to determine if

even or odd.

Next, try using two separate loops. One for incrementing and one for decrementing.

Code:

// start with one and work up to the number input by the user,
// incrementing by 2
for (int i = 1; i <= iMaxNum; i+=2)
{
// Output the number of characters here - format is up to you.
// A function would be ideal for this.
}
// Start working your way back done to 1 character using the
// input number minus 2 as a starting position, decrementing by 2.
for (int j = iMaxNum - 2; j >= 1; j-=2)
{
// Again, output the number of characters here.
}

This is just one way of accomplishing this. Others may offer

different options, but I felt that this would be easy to follow.

Hope that helps.

David