본문 바로가기

JAVA/Example

for문을 이용하여 *를 다음과같이 출력하라

*

**

***

****

*****

public class main {

	public static void main(String[] args) {
		for(int x=0;x<5;x++){
			for(int y=0;y<=x;y++){
				System.out.print("*");
			}System.out.println("");
		}
		
	}

}