CSP认证 201512-1 数位之和

基本操作,不多说

//
// Created by 29273 on 2021-04-02.
//
#include "bits/stdc++.h"

using namespace std;

int main() {
    int n, num = 0;
    cin >> n;
    while (n) {
        num += n % 10;
        n /= 10;
    }
    cout << num << endl;
    return 0;
}
posted @ 2021-04-09 15:15  沃特艾文儿  阅读(10)  评论(0)    收藏  举报  来源