Skip to content

Instantly share code, notes, and snippets.

@ramyo564
Created November 1, 2023 16:56
Show Gist options
  • Save ramyo564/93c984d8752aa008a3ae6257b0904530 to your computer and use it in GitHub Desktop.
Save ramyo564/93c984d8752aa008a3ae6257b0904530 to your computer and use it in GitHub Desktop.
public class Main {
public static void main(String[] args) {
System.out.println("[구구단 출력]");
int start = 1;
while (start < 10) {
for (int i = 1; i < 10; i++) {
int result = i*start;
if (result < 10){
String multiplicationTable = String.format("0%s x 0%s = 0%s", i, start, result);
System.out.print(multiplicationTable + " ");
}else {
String multiplicationTable = String.format("0%s x 0%s = %s", i, start, result);
System.out.print(multiplicationTable + " ");
}
}
System.out.println();
start += 1;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment