You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
#include <stdio.h>
|
|
int a[16];
|
|
int main(void)
|
|
{
|
|
int num,i,b,j;
|
|
printf("请输入排序的个数:");
|
|
scanf("%d",&num);
|
|
printf("请输入排序数:");
|
|
for(i=0;i<num;i++) //计数
|
|
{
|
|
scanf("%d",&b);
|
|
a[b]++;
|
|
}
|
|
printf("排序后的序列:");
|
|
for(i=0;i<16;i++) //输出
|
|
{
|
|
j=a[i];
|
|
while(j>0)
|
|
{
|
|
printf("%d ",i);
|
|
j--;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|