Given an input, I want to print a square like this:
Enter number: 5
#####
#####
#####
#####
#####
My attempt:
int n;
int col=0;
int row=0;
//user input blah blah
while (col < n) {
while (row < n) {
printf("#");
row++;
}
col++;
printf("\n");
}
But it isn’t printing what I’m expecting… can anyone fix this?
EDIT: The actual output looks like this (followed by 4 \n characters, SO doesn’t seem to display it).
#####
1 Answer