题解 | 添加逗号

添加逗号

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

#include <stdio.h>
#include <string.h>
int main() 
{
    char N[20]={0};
    scanf("%s",N);
    int a=strlen(N);
    for(int i=0;i<a;i++)
    {
        printf("%c",N[i]);
        if((a-i-1)%3==0&&i!=a-1)
        printf(",");
    }  
    return 0;
}

全部评论

相关推荐

孙艹肘:校招不给三方直接让实习我都去了,,主打一个在学校呆着也是闲着,不如出来实习一下
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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