Skip to content

Instantly share code, notes, and snippets.

@Tokiyomi
Created October 24, 2022 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tokiyomi/fb38b0ed6827e7f239e8c6df80e9d475 to your computer and use it in GitHub Desktop.
Save Tokiyomi/fb38b0ed6827e7f239e8c6df80e9d475 to your computer and use it in GitHub Desktop.
// Constructing the string to print multiple times
String plus = "";
String bars = "";
// Plus sign string
for (int i = 0; i < cols ; i ++) {
plus += "+-";
}
plus += "+";
// Bar sign string
for (int i = 0; i < cols ; i ++) {
bars += "|.";
}
bars += "|";
// Printing rest of the punch card
for (int i = 0; i < rows ; i ++) {
print(plus);
if (i == rows - 1) {
continue;
} else {
print(bars);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment