티스토리 뷰

PS/etc

chapter1) 덧셈표 작성

kingsubin 2020. 7. 6. 21:20
public class Q13 {
    public static void main(String[] args) {

        System.out.println("   |  1  2  3  4  5  6  7  8  9 ");
        for (int i = 1; i <= 9; i++) {
            System.out.printf("%2d |" , i);
            for (int j = 1; j <= 9; j++) {
                System.out.printf("%3d", i + j);
            }
            System.out.println();
        }

    }
}

 

'PS > etc' 카테고리의 다른 글

chapter1) 직각 이등변 삼각형 별찍기  (0) 2020.07.06
chapter1) 사각형 별찍기  (0) 2020.07.06
chapter1) 곱셈표 작성  (0) 2020.07.06
chapter1) 양의 정수 자릿수 구하기  (0) 2020.07.06
chapter1) 두 수의 차 구하기  (0) 2020.07.06