201512-1 数位之和

实现

#include <cstdio>

int main() {
    long long num;
    scanf("%lld",&num);

    int sum = 0;

    while (num != 0)
    {
        sum += num % 10;
        num /= 10;
    }

    printf("%d",sum);
    
}
posted @ 2020-08-30 13:36  amonqsq  阅读(81)  评论(0编辑  收藏  举报