美文网首页
1001 A+B Format (20 分)

1001 A+B Format (20 分)

作者: 79d12e22ec53 | 来源:发表于2019-07-30 18:58 被阅读0次
#include<stdio.h>
#include<math.h>
int main()
{
    int a, b, sum, c;
    scanf("%d %d", &a, &b);
    sum = a + b;
    c = abs(sum);
    if(c<1000)
        printf("%d", sum);
    if(c>=1000 && c<1000000)
        printf("%d,%03d", sum/1000, c%1000);
    if(c>=1000000)
        printf("%d,%03d,%03d", sum/1000000, c%1000000/1000, c%1000000%1000);
}

相关文章

网友评论

      本文标题:1001 A+B Format (20 分)

      本文链接:https://www.haomeiwen.com/subject/djlorctx.html