0

I cannot figure out why the do while loop does not re-prompt the user for a number when the user input falls outside of the range indicated by the boolean expression. Any ideas? Code below:

    #include <stdio.h>
    #include <cs50.h>

    int main(void)
    {


        int height;

        do
        {
            printf("How high is the pyramid?(Must be a number between 1 and  23.):\n"); 
            height=GetInt(); 
        }
        while(height >=1 && height <= 23);

    }
1
while (Height < 0 || Height > 23);

I think this is really what you want

1
  • Thanks for the help. – acb0019 Aug 1 '16 at 3:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .