I am trying to produce a specific pattern (shown below) using C programming. I wrote the following code, that does not produce the same output. Would anyone please suggest how I can correct it?
It looks more like code you "found" rather than code you wrote.
For one thing, it peaks at a height of 5, whereas your requirement stops at 4.
If you had worked your way to that solution iteratively, you would have easily concluded that the solution was another nested for loop to print the central rectangle.
Consider a pattern of the following form.
1 2 3 4 5 6 7 8 9 10
A
A A
A A A
B B B B
B B B B
B B B B
B B B B
C C C
C C
C