【PAT B1006】换个格式输出整数(C语言)

#include <stdio.h>

int main() {

    int x,b,s,g,i=1;
    scanf("%d", &x);
    b = x / 100;
    s = x / 10 % 10;
    g = x % 10;
    while (b) {
        printf("B");
        b--;
    }
    while (s) {
        printf("S");
        s--;
    }
    while (g) {
        printf("%d", i);
        i++;
        g--;
    }
    return 0;
}
全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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