I am trying to print a traditional three sided triangle, and I have the

left side of the triangle done with decreasing spaces and asterisks.

now i need to embed the secod loop within the first to be able to

print the empty spaces within and the second set of asterisks comprising the right side of the triangle. so I need to embed or nest that loop in the first loop.

the sequence of empty spaces for the middle and the second set of

asterisks is first row aempty space asterisk

second row three empty spaces asterisk

third row five empty spaces asterisk

here's my code . . .

#include <iostream> using namespace std; int main () { int x = 0, n = 0, y = 0, limit = 0, z = 0, j = 0, numberOfRows = 0, line = 9, spaces = 0; ; cout << "Enter the base width of triangle to draw. \n"; cout << "Odd integers only between 3 and 41 <other values will quit>: \n"; do { cin >> x; limit = x/2; numberOfRows = x/2 + 1; for (y = 0; y <= limit; y++) { cout << " "; } cout << "*\n"; for (n = 0; n < numberOfRows - 2; n++) { limit = limit - 1; for (z = limit; 0 < z; z--) { cout << " "; } cout << "*"; spaces = line + 2; for (j = 1; j < spaces; j++) { cout << " "; } cout << "*" << endl; } } while (x % 2 == 0 || x < 1 || x > 41); cout << "You entered an invalid number." << endl; return (0); }Mod Edit: added code tags: