题解 | #数位之和#

数位之和

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

#include <stdio.h>
int main()//每次取比10大的部分
{
    int input=0,ret=0;
    scanf("%d",&input);
    while(input>=10)
    {
        int a=input%10;
        ret=ret+a;
        input=(int)input/10;
    }
    printf("%d",ret+input);
    return 0;
}

全部评论

相关推荐

09-28 22:01
已编辑
广西科技大学 IT技术支持
合适才能收到offe...:找桌面运维?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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