题解 | 数位之和

数位之和

https://www.nowcoder.com/practice/5e85cc26475449648e668aa98e92d05b

#include <stdio.h>

int main() 
{
    int n,ret=0;
    scanf("%d",&n);
    while(n)
    {
        ret+=n%10;
        n/=10;
    }
    printf("%d",ret);
}

全部评论

相关推荐

牛客21331815...:像我一投就pass,根本不用焦虑泡池子
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务