Skip to content

Commit 0c05d04

Browse files
authored
src
1 parent bfda784 commit 0c05d04

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/codeup100/c1034.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package codeup;
2+
3+
import java.util.Scanner;
4+
5+
public class c1034 {
6+
public static void main(String[] args) {
7+
Scanner sc = new Scanner(System.in);
8+
System.out.println("10진수로 변환할 8진수 입력: "); // c1031번과 반대 !
9+
int num = sc.nextInt(8); // 8진수 정수 입력
10+
sc.close();
11+
12+
System.out.printf("%d", num);
13+
}
14+
}
15+
16+
// 1. 입력 클래스인 Scanner 객체 생성
17+
// 2. 8진수 입력
18+
// ->nextInt(?) : ?이 공백이면 default로 10진수, 숫자를 넣으면 해당 숫자의 진법으로 연산
19+
// 3. 입력 종료되었으므로 객체 닫기
20+
// 4. 8진수를 10진수로 변환하여 출력(printf문 이용)

0 commit comments

Comments
 (0)