Skip to content

Instantly share code, notes, and snippets.

@soeunkk
Last active September 15, 2022 11:48
Show Gist options
  • Save soeunkk/5c82b4b61813b94e5feee7daccd2ebab to your computer and use it in GitHub Desktop.
Save soeunkk/5c82b4b61813b94e5feee7daccd2ebab to your computer and use it in GitHub Desktop.
/*
* 김소은
* 과제1. 콘솔 화면에 구구단 출력하기
*/
public class Test1 {
public static void main(String[] args) {
System.out.println("[구구단 출력]");
StringBuilder multiplicationTable = new StringBuilder();
for (int y = 1; y <= 9; y++) {
for (int x = 1; x <= 9; x++) {
String formula = String.format("%02d x %02d = %02d", x, y, x * y);
multiplicationTable.append(formula).append("\t");
}
multiplicationTable.append("\n");
}
System.out.println(multiplicationTable);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment