9, 7, 5, 3, 1 ..으로 가는 거꾸로된 대칭 별찍기

생각이 좀 필요했다

 

 

깃허브

https://github.com/kindacool/etc/blob/main/ReverseStar.java

 

GitHub - kindacool/etc

Contribute to kindacool/etc development by creating an account on GitHub.

github.com

 

 

코드

package p2022_07_11;

public class ReverseStar {

	public static void main(String[] args) {

		final int lineNum = 10;
		for (int i = 1; i <= lineNum; i++) {

			for (int j = 1; j < i; j++) {
				System.out.print(" ");
			}
			for (int k = 2 * lineNum - 1; k >= 2 * i - 1; k--) {
				System.out.print("*");
			}
			System.out.println();
		}
	}
}

 

 

출력

+ Recent posts