Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- Number Theory
- Method
- database
- Matrix
- string
- array
- bit manipulation
- 구현
- Class
- hash table
- 코테
- 파이썬
- 코딩테스트
- simulation
- SQL
- sorting
- implement
- Stack
- geometry
- Data Structure
- 자바
- java
- dynamic programming
- Math
- Counting
- two pointers
- Binary Search
- greedy
- Binary Tree
- Tree
Archives
- Today
- Total
코린이의 소소한 공부노트
[프로그래머스/Lv.0] 직각삼각형 출력하기 본문
1. Input
1) 정수 n
2. Output
1) 높이와 너비가 n인 직각삼각형 출력
2) 직각삼각형은 “*”로 그림
3. Constraint
1) 1 <= n <= 10
2) “*”의 높이와 너비는 모두 1
4. Example
Input: n=3 -> Output: *
**
***
5. Code
1) 첫 코드(2022/10/20)
import java.util.Scanner;
// main()
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for(int i=1 ; i<=n ; i++){
for(int j=1 ; j<=i ; j++)
System.out.print("*");
System.out.println();
}
'코딩테스트 풀이 > JAVA' 카테고리의 다른 글
[프로그래머스/Lv.0] 문자 반복 출력하기 (0) | 2022.10.21 |
---|---|
[프로그래머스/Lv.0] 짝수 홀수 개수 (0) | 2022.10.21 |
[프로그래머스/Lv.0] 문자열 뒤집기 (0) | 2022.10.21 |
[프로그래머스/Lv.0] 배열 뒤집기 (0) | 2022.10.20 |
[프로그래머스/Lv.0] 나이 출력 (0) | 2022.10.20 |