-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc1027.java
More file actions
26 lines (21 loc) ยท 758 Bytes
/
Copy pathc1027.java
File metadata and controls
26 lines (21 loc) ยท 758 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
25
26
๐ก๐ก๐ก๐ก
import java.util.Scanner;
public class c1027 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("์ฐ์์ผ ์
๋ ฅ: ");
String date = sc.nextLine();
sc.close();
String[] arr = date.split("\\.");
int[] arr2 = new int[arr.length];
for(int i = 0; i < arr.length; i++){
arr2[i] = Integer.parseInt(arr[i]);
}
System.out.printf("%02d-%02d-%04d", arr2[2], arr2[1], arr2[0]);
}
}
// ์
๋ ฅ ํด๋์ค์ธ Scanner ๊ฐ์ฒด ์์ฑ
// '.'์ผ๋ก ๊ตฌ๋ถํ์ฌ ์ฐ์์ผ ์
๋ ฅ
// arr์ ๊ธธ์ด์ ๋ง์ถฐ intํ ๋ฐฐ์ด ์ ์ธ(arr2)
// arr2์ arr์ ๋ฐ์ดํฐ๋ค์ intํ์ผ๋ก ๋ณํํ์ฌ ์ ์ฅ
// ์ถ๋ ฅ