Created
December 7, 2015 01:15
-
-
Save mindwing/042376783c2380416048 to your computer and use it in GitHub Desktop.
도전과제 3 을 변형하여 String 끼리 더하지 않고 for 도 하나만 써서 결과물을 낼 수 있게 했습니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Fast Campus 안드로이드 앱 개발 입문 캠프 | |
* Java for Android (by mindwing) | |
* [3일차] 강의노트 - 배열, 메서드 정의와 호출방법, I/O | |
* 도전과제3 - 커맨드 라인 인자길이의 밑변을 가지는 직각삼각형 모양 출력 | |
*/ | |
public class D3_Challenge_3_2 { | |
public static void main(String[] args) { | |
if (args.length == 0) { | |
System.out.println("직각삼각형 밑변의 길이를 정해주세요."); | |
return; | |
} | |
int limit = Integer.parseInt(args[0]); | |
for (int i = 0, line = 0; i < limit; i = i + 1) { | |
if (line < limit && i == line) { | |
i = 0; | |
System.out.println(" "); | |
} | |
System.out.print("*"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment