import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String before = sc.next();
System.out.println(before);
int after = Integer.parseInt(before.substring(0,2));
System.out.println(after);
}
}
Integer.parseInt()는 문자열(String) 로 되어 있는 숫자를 정수(int) 로 바꿔주는 함수
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String T = sc.next();
int sum = 0;
for(int test_case=0;test_case<T.length();test_case++){
sum += T.charAt(test_case) - '0';
}
System.out.println(sum);
}
}
package SWEA;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[] arr = new int[N];
for(int i = 0; i < N; i++){
arr[i] = sc.nextInt();
}
Arrays.sort(arr);
int midIndex = N/2;
System.out.println(arr[midIndex]);
}
}