일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- hyperledger transaction
- #bubbleSort
- mac terminal command
- #C++ 연산자함수오버로딩
- html plug-in
- #CallByAddress
- #binary
- docker example
- #3차원배열
- git flow
- 토큰경제
- #C++ has~a
- #JAVASCRIPT
- html youtube
- html id
- #1차원배열
- html multimedia
- border-box
- #android activity
- html object
- #성적관리프로그램
- html code
- html video
- #다차원포인터
- 하이퍼레저패브릭
- #2차원배열
- relative path
- #자바상속#자바이즈어#is~a
- html5 new tag
- html charset
Archives
- Today
- Total
A sentimental robot
콜라체의 수 / 우박수 본문
// 어떤 수든 1로 수렴
int n = 2018;
while (true) {
System.out.println(n);
if (n % 2 == 0)
n = n / 2;
else
n = n * 3 + 1;
if (n == 1)
break;
}
System.out.println(n);
// 삼항 연산자 사용
int n = 2018;
while (true) {
System.out.println(n);
n = (n % 2 == 0) ? n / 2 : n * 3 + 1;
if (n == 1)
break;
}
System.out.println(n);
'Data Structure' 카테고리의 다른 글
quirt some (0) | 2018.02.13 |
---|---|
Bubble sort (0) | 2018.01.03 |
Double LinkedList (0) | 2018.01.03 |
Single LinkedList Exercise3 (0) | 2018.01.03 |
Map에 대하여.. (0) | 2018.01.03 |