본문 바로가기
JAVA/응용문제

for문 별 찍기

by java나유 2022. 7. 16.

 


  
public class star1 {
public static void main(String[] args) {
for(int i=0;i<10;i++) {
for(int h=0;h<=i;h++) {
System.out.print("*");
}
System.out.println();
}
for(int a=10;a>=0;a--) {
for(int j=0;j<=a;j++) {
System.out.print("*");
}
System.out.println();
}
}
}

728x90

댓글