The following is my code for PSET1 Mario.c where the expected outcome is the user is prompted for a height number between 1-23, and based on that number, it builds a half pyramid with the "#" symbol. However, my code repeatedly asks for the Height instead of printing anything. Any hints/suggestions where I went wrong? Thank you in advance!
do/while loop will execute as long as
height >= 0 || height <= 23 is true. Since it's an or condition, it is true if either is true. Every integer will return true, because every integer is either
>= 0 or
<= 23. Think of the while loop in terms of the inputs you want to reject. Once you have a valid input, don't do the loop any more.