#include<stdio.h> int main() { int num,insert_num,i,tmp;//输入的数字,插入的数字,循环计数 int arr1[51] = {0}; //输入变量 scanf("%d",&num); for(i = 0;i<num;i++) { scanf("%d",&arr1[i]); } getchar(); scanf("%d",&insert_num); //找到所在的下标 for(i = 0;i<=num;i++) { if(insert_num<arr1[i]) { tmp = arr1[i]; arr1[i] = insert_num; insert_num = tmp; }
}
arr1[num] = insert_num;
for(i = 0;i<=num;i++)
{
printf("%d ",arr1[i]);
}
return 0;
}