별트리 오른쪽으로 찍기

 

 

깃허브

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

 

GitHub - kindacool/etc

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

github.com

 

 

코드

package p2022_07_08;

public class RightStar {

	public static void main(String[] args) {

		final int lineNum = 10;
		
		for (int i = 1; i <= lineNum; i++) // 10줄
		{
			for (int s = lineNum; s > i ; s--) {
				System.out.print(" ");
			}

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

	}

}

 

 

출력

+ Recent posts