#include <cs50.h>
#include <stdio.h>
int main(void)
{
int n;
do
{
n=get_int("Size: ");
}
while (n < 8);
for (int i = 0; i < n; i++)
{
printf("#");
}
printf("\n");
}
I want the code to display the number of #s that the user prompts it to, Given that the number prompted is between 1 and 8. Here, the code reprompts the used when the prompt given is less than 8 and displays when its more. Which is the opposite of what I wish to achieve.
Moreover, the code seems to work the way I want it to when I change (n < 8) to (n > 8). Kindly tell me why this occurs.
You need to understand the effect of the conditional that you use.
Have some fun. Try this