본문으로 바로가기

[기초 반복문] 피라미드 만들기

category JAVA 2019. 1. 13. 23:42
반응형


public class ex1 {

	public static void main(String[] args) {
		
		int i, j, c; //변수 생성
		
		for(i = 0 ; i < 10; i++) {         // 10번반복
			for(j = 1; j <= 10-i; j++) {    // 공백 
			
				System.out.print(" ");
			}
			for(c = 0; c < i*2+1; c++) { //별 
			
			System.out.print("*");
		}
			System.out.println("");

	}
		

 }
}
반응형