回答編集履歴
1
コードと実行例の修正
test
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
System.out.println("Enter a telephone number as 10 digits, unformatted >");
|
8
8
|
int num = scanner.nextInt();
|
9
9
|
System.out.printf("%03d %03d %04d%n",
|
10
|
-
num/10000000, num/10000%1000, num%1000);
|
10
|
+
num/10000000, num/10000%1000, num%10000);
|
11
11
|
}
|
12
12
|
}
|
13
13
|
```
|
@@ -15,7 +15,7 @@
|
|
15
15
|
```text
|
16
16
|
Enter a telephone number as 10 digits, unformatted >
|
17
17
|
2147483647
|
18
|
-
214 748
|
18
|
+
214 748 3647
|
19
19
|
```
|
20
20
|
ただし、int を使う限りこれより大きな値は使用できません。
|
21
21
|
`long num = scanner.nextLong();` にすれば 10桁の整数全部を扱えます。
|