public class 사열구구단클래스 {
public static void main(String[] args) {
System.out.format("%n < SKY 구구단 >%n");
// for (int j = 1; j <= 9; j++) {
for (int i = 2; i <= 5; i++) { // 2단 ~ 5단까지
// for (int i = 1; i <= 5; i++) {
System.out.println();
for (int j = 1; j <= 9; j++) { // 2단 ~ 5단까지
// for (int i = 2; i <= 5; i=i+1) { // 2단 ~ 5단까지
// System.out.format("%d X %d = %2d ", i, j, i * j);
System.out.println(i + " X " + j + " = " + i * j);
// System.out.println(j + " X " + i + " = " + i * j);
}
}
System.out.println(); // 줄바꿈
System.out.format("--- sky --- SKY --- 구구단 ---"); //
for (int j = 1; j <= 9; j++) {
System.out.println();
for (int i = 6; i <= 9; i++) { // 6단 ~ 9단까지
System.out.format("%d X %d = %2d ", i, j, i * j);
}
}
System.out.println(); // 줄바꿈
}
}
public class 일렬구구단클래스 {
// public static void main(String[] args) {
// static public void main(String[] args) {
static public void main(String args[]) {
int temp = 0;
for (int j = 2; j < 10; j++) {
System.out.println(j + " 단 ");
for (int i = 1; i < 10; i++) {
temp = j * i;
// System.out.println(j + " X " + i + " = " + i * j);
System.out.format("%d X %d = %2d %n", j , i , temp);
// System.out.format("%d X %d = %2d ", j , i , temp);
}
}
System.out.println("temp=" + temp);
}
}
'정보과학 IT' 카테고리의 다른 글
통합 인증(Single Sign-On, SSO) (0) | 2013.10.10 |
---|---|
HTTP 와 HTTPS (0) | 2013.10.10 |
public static void main(String[] args) (0) | 2013.10.09 |
안드로이드 개발을 위한 이클립스 설치와 SDK 셋팅 (0) | 2013.10.08 |
이클립스에 ADT 플러그인 설치하기 (0) | 2013.10.08 |