자바 혼자 공부중인디.. 위 사진처럼 만들려면 패턴찾아서  i + j <= n-1를 넣어야되잖앙




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.util.Scanner;
 
public class Star02 {
 
    public static void main(String[] args) {
 
        Scanner sc = new Scanner(System.in);
 
        System.out.println("별찍기입니다. 원하는 줄을 입력하시오 : ");
        int n = sc.nextInt();
 
        int i, j;
 
        for (i = 0; i <= n; i++) {
            for (j = 0; j <= n; j++) {
 
                System.out.print("*");
            }
            System.out.println();
        }
    }
 
}
 
cs

이게 내 코드인데 저렇게 만들려면  i + j <= n-1 조건을 어따가 넣어야 되느거지???