Last active
September 15, 2022 11:48
-
-
Save soeunkk/5c82b4b61813b94e5feee7daccd2ebab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 김소은 | |
* 과제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