public class Ex14 {
    public static void main(String[] args) {
        // Q1.
        System.out.println("Q1.");
        for(int i = 1; i < 10; i++){
            System.out.print(i + " ");
            if(i % 3 == 0){
                System.out.println();
            }
        }
        System.out.println();
        // Q2.
        System.out.println("Q2.");
        for(int i = 1; i < 4; i++){
            for(int a = 0; a < 3; a++){
                int n;
                n = a + i;
                System.out.print(n + " ");
            }
            System.out.println();
        }
        System.out.println();
        // Q3.
        System.out.println("Q3.");
        char a = 'A';
        char end = 'Z';
        int col = 4;
        do{
            System.out.print((char)(a) + " ");
            a++;
            if(a % col == 2){
                System.out.println();
            }
        }while(a<=end);
        System.out.println("\n");
        // Q4.
        System.out.println("Q4.");
        for(int i = 1; i <= 3; i++){
            for(int b = 0; b < i; b++){
                System.out.print(i + " ");
            }
            System.out.println();
        }
        System.out.println();
        // Q5.
        System.out.println("Q5.");
        for(int i = 1; i <= 3; i++){
            for(int b = 1; b <= i; b++){
                System.out.print(b + " ");
            }
            System.out.println();
        }
        System.out.println();
        // Q6.
        System.out.println("Q6.");
        int e = 1;
        for(int i = 1; i <= 3; i++){
            for(int j = e; j < e+i; j++){
                System.out.print(j + " ");
            }
            e += i;
            System.out.println();
            // System.out.print(i + " ");
            // if(i==1 || i==3){
            //     System.out.println();
            // }
        }
        System.out.println("\n");
        // Q7.
        System.out.println("Q7."); 
        int i = 1;
        int c = 0;
        while(i <= 100){
            if(i % 2 ==0){
                c += i;
            }
            i++;
        }
        System.out.println("1~100까지의 수 중에 짝수의 합은 " + c + "이다.");
        System.out.println("\n");
        // Q8.
        System.out.println("Q8."); 
        int odds = 0;
        for(int x = 1; x < 10; x+=2){
            odds += x;
            System.out.print(x + " + ");
        }
        System.out.print("= " + odds);
        System.out.println("\n");
        // Q9.
        System.out.println("Q9."); 
        System.out.println("<print/>");
    }
}
