-
4. control - (3) StarDemo (별 출력)java/코드 리뷰 2020. 3. 23. 15:581234567891011121314151617181920212223242526272829package control;public class StarDemo3 {public static void main(String[] args) {/*** i=1 => 공백:8 별:2**** i=2 => 공백:6 별:4****** i=3 => 공백:4 별:6******** i=4 => 공백:2 별:8********** i=5 => 공백:0 별:10*/for(int i=1; i<=5; i++) {// 공백 출력for(int j=1; j<=10-i*2; j++) {System.out.print(" ");}// 별 출력for(int k=1; k<=i*2; k++) {System.out.print("*");}System.out.println();}}}
'java > 코드 리뷰' 카테고리의 다른 글
4. control - (5) StarDemo (별 출력) (0) 2020.03.23 4. control - (4) StarDemo (별 출력) (0) 2020.03.23 4. control - (2) StarDemo (별 출력) (0) 2020.03.23 4. control - (1) StarDemo (별 출력) (0) 2020.03.23 4. control - (3) Lotto3 (로또 중복발생 방지) (0) 2020.03.23