-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc1023.java
More file actions
24 lines (19 loc) ยท 756 Bytes
/
Copy pathc1023.java
File metadata and controls
24 lines (19 loc) ยท 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.util.Scanner;
public class c1023 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("์ค์ ์
๋ ฅ: ");
Double dNum = sc.nextDouble();
sc.close();
String[] arr = String.valueOf(dNum).split("\\.");
for(String a : arr){
System.out.println(a);
}
} // end c1023()
}
// ์
๋ ฅ ํด๋์ค์ธ Scanner ๊ฐ์ฒด ์์ฑ
// ์ค์๋ฅผ ์
๋ ฅ๋ฐ์ ๋ณ์ dNum์ ์ ์ฅ
// ์
๋ ฅ ์ข
๋ฃ๋์์ผ๋ฏ๋ก ๊ฐ์ฒด ๋ซ๊ธฐ
// dNum์ String ํํ๋ก ๋ณํํ๊ณ '.'์ ๊ธฐ์ค์ผ๋ก ๋ถํ ํ์ฌ String[]์ ๊ฐ์ ์ ์ฅํ๋ค.
// - arr[0] : 1, arr[1] : 414213 ์ ๊ฐ์ด ์ ์ฅ๋จ
// EnhancedLoop๋ฅผ ์ด์ฉํ์ฌ arr์ ๊ฐ๋ค์ ์ถ๋ ฅ