Question: C | How do I print boxes of #'s inside eachother with spaces inside like this: - This needs to be done WITHOUT arrays, using

C | How do I print boxes of #'s inside eachother with spaces inside like this:

- This needs to be done WITHOUT arrays, using only for/while loops and if/else statements.

:C | How do I print boxes of #'s inside eachother with

I have the following code as a starter If it's any help.

-------------------------------------------------------------------------

#include

int main(void) {

int boxes; printf("How many boxes: "); scanf("%d", &boxes); int boxSide = boxes *3 + (boxes - 1); int i; int j;

int row = 0;

while (row

if ((row % 2 == 0) && (column % 2 ==0)) { printf("#"); }

else if (row == 0 || row == boxSide-1 || column == 0 || column == boxSide-1) { printf("#"); }

else { printf(" "); }

column++; } row++; printf(" "); } return 0; }

s ./boxes How many boxes: 2 ./boxes How many boxes: 5

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 Databases Questions!