PAT[1006]换个格式输出整数

来源:互联网 发布:常用sql语句面试题 编辑:程序博客网 时间:2024/05/22 06:09
#include<stdio.h>
#include<stdlib.h>
void test(int n)
{
int x, y, z;
char a, b, c;
x = n / 100;
y = n / 10 % 10;
z = n % 10;
for (x;x<=x && x > 0;x--)
{
a = 'B';
printf("%c", a);
}
for (y; y <= y && y > 0; y--)
{
a = 'S';
printf("%c", a);
}
for (int i = 1; i <= z; i++)
{
printf("%d",i);
}
}
int main()
{
int n,i;
scanf_s("%d", &n);
test(n);
system("pause");
return 0;
}