I need to make half of a octagon, example below. I have the code written to read user input and check to make sure it meets all criteria. For this example below say that the user entered the Integer 4. The following needs to be printed:
I'm pretty bad at loops and have tried drawing it out, but still stuck. Below is the code written and the output it prints:
The output is:
Any help or guidance is most appreciated.
Thanks,
####
######
########
##########
I'm pretty bad at loops and have tried drawing it out, but still stuck. Below is the code written and the output it prints:
int size = 4;
for(row = 0; row < size; row++) {
for(col = 0; col < size * 3; col++) {
if(col < size) {
System.out.print(".");
}
else{
System.out.print("#");
}
}
System.out.println();
}
The output is:
....######## ....######## ....######## ....########
Any help or guidance is most appreciated.
Thanks,