๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Algorithm ๐Ÿง‘๐Ÿป‍๐Ÿ’ป/๋ฐฑ์ค€(BOJ)

[๋ฐฑ์ค€,c++] 11720๋ฒˆ - ์ˆซ์ž์˜ ํ•ฉ

by dkswnkk 2021. 10. 31.
#include <iostream>
using namespace std;

int main() {

    int cnt;
    char N;
    int sum = 0;
    cin >> cnt;

    while (cnt-- > 0) {
        cin >> N;
        sum += (N - '0');
    }
    cout << sum;
}

๋Œ“๊ธ€