题解 | #添加逗号#

添加逗号

https://www.nowcoder.com/practice/f51c317e745649c0900996fd3f683aed

#include <stdio.h>
#include <string.h>
int main() {
    char num[10];
    while (scanf("%s", num) != EOF) { // 注意 while 处理多个 case
        // 64 位输出请用 printf("%lld") to
        int z = strlen(num);
        for (int i = 0; i < z; i++) {
            if (i % 3 == z % 3 && i != 0)
                printf(",");
            printf("%c", num[i]);
        }
    }
    return 0;
}

全部评论

相关推荐

不愿透露姓名的神秘牛友
昨天 11:00
点赞 评论 收藏
分享
点赞 评论 收藏
分享
06-02 15:17
门头沟学院 Java
心爱的idea:怎么会呢 应该是打招呼有问题 问就说实习6个月全国可飞随时到岗
点赞 评论 收藏
分享
05-22 09:23
门头沟学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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