Question: I need help fixing this code. Its supposed to loop back to the beginning and continue to loop until the user doesnt input a character.

I need help fixing this code. Its supposed to loop back to the beginning and continue to loop until the user doesnt input a character.
Though I cant seem to make it work, the challenging part is were not supposed to use if/condintional statements or breaks only loops and something called an EOF.
#include
int main(void)
{
char userChar;
int inputHeight, inputWidth;
printf("Enter a character: ");
scanf("%c", & userChar);
printf("
Now let's draw a rectangle with your %c
", userChar);
printf("
Enter two integers - one for length, one for height: ");
scanf("%d %d", &inputHeight, &inputWidth);
printf("
You entered %d and %d
", inputHeight, inputWidth);
for (int i =0; i < inputHeight; i++)
{
for (int j =0; j < inputWidth; j++)
{
printf("%c",(i ==0|| i == inputHeight -1|| j ==0|| j == inputWidth -1)? userChar : '');
}
printf("
");
}
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!