티스토리 뷰
아래와 같은 고양이 출력
3. 고양이 | 4. 개 |
\ /\ ) ( ') ( / ) \(__)| |
|\_/| |q p| /} ( 0 )"""\ |"^"` | ||_/=\\__| |
Java 특수문자 출력하는 방법
-백슬러시(\) 사용
입력 | \\ | \' | \" |
출력 | \ | ' | " |
-입력 → 출력
괄호, 슬래시(/), 백팁(`)
-공백 및 줄바꿈
줄바꿈 | 줄의 맨처음 | 탭 | 백스페이스 | 빈 칸(null) |
\n | \r | \t | \b | \0 |
-3번. 처음 작성
public class Main {
public static void main(String[] args){
System.out.println("\\ \0\0\0/\\");
System.out.println(" )\0 ( ')");
System.out.println("( \0/ \0)");
System.out.println(" \\(__)|");
}
}
-처음 제출
public class Main {
public static void main(String[] args){
System.out.println("\\ \0\0\0/\\\n )\0 ( ')\n( \0/ \0) \n \\(__)|");
}
}
*스페이스바를 여러 번 입력해도 공백 하나로 입력된다고 생각해서 공백 입력한다고 \0 엄청 썼는데...
스페이스바 친만큼 공백으로 출력되었음. 수정 ↓
public class Main {
public static void main(String[] args){
System.out.println("\\ /\\\n ) ( ')\n( / )\n \\(__)|");
}
}
4번 개
-처음 입력할 때,
public class Main{
public static void main(String[]args){
System.out.println("|\\_/|");
System.out.println("|q p| /}");
System.out.println("( 0 )\"\"\"\\");
System.out.println("|\"^\"` |");
System.out.println("||_/=\\\\__|");
}
}
-제출
public class Main{
public static void main(String[]args){
System.out.println("|\\_/|\n|q p| /}\n( 0 )\"\"\"\\\n|\"^\"` |\n||_/=\\\\__|");
}
}
'문제풀이 > _BAEKJOON' 카테고리의 다른 글
[단계1]10430번 나머지 (0) | 2022.02.09 |
---|---|
[단계1]18108번 1998년생인 내가 태국에서는 2541년생?! (0) | 2022.02.09 |
[단계1_8]??! 출력하기 (0) | 2022.02.08 |
[단계1_3~7]사칙 연산 (0) | 2022.02.07 |
[단계1_1]Hello World 출력 (0) | 2022.02.04 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- border-spacing
- caption-side
- css
- initialized
- empty-cell
- A%B
- html pre
- html layout
- text formatting
- html a tag
- scanner
- CascadingStyleSheet
- improt
- ScriptTag
- typeof
- html base tag
- JavaScript
- html atrribute
- html input type
- Java
- html
- input type 종류
- 외부구성요소
- 미디어 태그
- 입력양식
- 변수
- 기본선택자
- selcetor
- 스크립태그
- BAEKJOON
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함