Auto commit

This commit is contained in:
smallkun 2025-03-25 09:44:29 +08:00
parent 537578994c
commit 0699f7825b

View File

@ -52,8 +52,6 @@ int main(){
### 2 数组的批量删
题目设计程序删除数组中所有值为x 的元素
@ -68,6 +66,35 @@ int main(){
输出样例1 3
```
```c
#include <stdio.h>
int main(){
int a[100];
int len, i, j = 0, num;
scanf("%d", &len);
for(i=0;i<len;i++){
scanf("%d", a+i);
}
scanf("%d", &num);
for(i=0;i<len;i++){
if(a[i] != num){
a[j++] = a[i];
}
}
for(i=j;i<len;i++){
a[i]=0;
}
for(i=0;i<j;i++){
printf("%d ", a[i]);
}
printf("\n");
return 0;
}
```
### 3 左小右大