so I have absolutely no experience with coding. I've been trying to solve the mario less exercise from week 1 on CS50 but my hashtags keep printing in reverse order, so I get an inverted pyramid. I've tried looking for solutions online but I can't understand how it works. I've also tried changing values here and there, but since I don't understand how I'm telling the machine to print a symbol X times, I'm obviously not doing the right changes. The changes I can remember at the moment are setting g to 23 and then decreasing g, I've tried doing h+1 or h-1. So what's the logic behind it? How do I get it to start printing two #s and then increasing its value? So my code is:
And what that produces is:
Thanks!
EDIT! I changed the code and now it'll print the hashtags in the right way BUT it'll go back to doing it backwards IF I enter an invalid number first. Please help.
NEW CODE
And what happens is:
Last edit (if anyone's curious) I changed the first lines of the code to the suggested do while loop. It's all good now.