Change this
for(d=z; d>=1; d--)
to this
for(d=x; d>x-z; d--)
Now tell me why that works and what you were doing wrong. :)
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
You could use up counting for to increment the stop condition of inner loop and manage with two nested fors.
pyTony
pyMod
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
In the line 1 declare x as int instead of char. It would be better that way.
Arbus
Practically a Master Poster
615 posts since Dec 2010
Reputation Points: 45
Solved Threads: 31