#include <stdio.h>
void Bubble_Sort(int a[],int len)
{
int i,j,temp;
for(i = 0 ; i < len -1; i ++)
{
for(j = 0; j < len - 1 - i; j ++)
{
if(a[j] > a[j + 1])
{
temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
}
}
}
}
int main(void)
{
int num[10];
int i ,j;
int shu[51];
int geshu = 0;
for(i = 0; i < 10 ;i ++)
{
scanf("%d",num+i);
}
//==========================================
for(i = 0 ; i < 10 ;i ++)
{
for(j = num[i]; j > 0; j --)
{
shu[geshu ++] = i;
}
}
Bubble_Sort(shu,geshu);
//=====================================
for(i = 0; i < geshu; i ++)
{
if(shu[i] != 0)
break;
}
int temp;
temp = shu[i];
shu[i] = shu[0];
shu[0] = temp;
for(j = 0; j < geshu; j ++)
{
printf("%d",shu[j]);
}
return 0;
}
09-16
1018
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交