
문제

I.O

코드 및 해석
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Boj_11720 {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int N = Integer.parseInt(br.readLine());
		int sum = 0;
		String str = br.readLine();
		
		for(int i = 0 ; i < str.length() ; i++) {
			sum += str.charAt(i) - '0';
		}
		System.out.println(sum);
	}
}
문제 및 사진출처
출처 - 백준 알고리즘_11720번