当前位置:网站首页>Delete all elements with a value of Y. The values of array elements and y are entered by the main function through the keyboard.
Delete all elements with a value of Y. The values of array elements and y are entered by the main function through the keyboard.
2022-07-04 00:41:00 【CTGU-Yoghurt】
subject :
Delete all values as y The elements of . The sum of the values in the array elements y The value of is determined by
The main function inputs... Through the keyboard .
Code details :
#include <stdio.h>
#include<conio.h>
#include<stdio.h>
#define M 20
void fun(int bb[], int* n, int y)
{
/**********Program**********/
for (int i = 0; i < *n;)
{
if (bb[i] == y) {
for (int j = i; j < *n; j++)
{
bb[j] = bb[j + 1];
}
(* n)--;// notes :-- The priority is * In front of , So expand with parentheses
}
else i++;
}
/********** End **********/
}
int main()
{
int aa[M], n, y, k;
printf("\nPlease enter n:"); scanf("%d", &n);
printf("\nEnter %d positive number:\n", n);
for (k = 0; k < n; k++) scanf("%d", &aa[k]);
printf("The original data is:\n");
for (k = 0; k < n; k++) printf("%5d", aa[k]);
printf("\nEnter a number to deletede:"); scanf("%d", &y);
fun(aa, &n, y);
printf("The data after deleted %d:\n", y);
for (k = 0; k < n; k++) printf("%4d", aa[k]);
printf("\n");
return 0;
}边栏推荐
- Introduction to thread pool
- For loop
- How to be a professional software testing engineer? Listen to the byte five year old test
- [leetcode] interview question 17.08 Circus tower
- Interview script of Software Test Engineer
- Similarities and differences of text similarity between Jaccard and cosine
- 功能:求5行5列矩阵的主、副对角线上元素之和。注意, 两条对角线相交的元素只加一次。例如:主函数中给出的矩阵的两条对角线的和为45。
- [dynamic programming] leetcode 53: maximum subarray sum
- It is worthy of "Alibaba internal software test interview notes" from beginning to end, all of which are essence
- MySQL winter vacation self-study 2022 12 (1)
猜你喜欢
![[common error] custom IP instantiation error](/img/de/d3f90cd224274d87fcf153bb9244d7.jpg)
[common error] custom IP instantiation error

1-Redis架构设计到使用场景-四种部署运行模式(上)

BBS forum recommendation

Future源码一观-JUC系列
![[complimentary ppt] kubemeet Chengdu review: make the delivery and management of cloud native applications easier!](/img/3f/75b3125f8779e6cf9467a30fd7eeb4.jpg)
[complimentary ppt] kubemeet Chengdu review: make the delivery and management of cloud native applications easier!
![[common error] UART cannot receive data error](/img/77/6ba56ce6e64beeb73a77d04af5bd0f.jpg)
[common error] UART cannot receive data error
![[error record] configure NDK header file path in Visual Studio](/img/9f/89f68c037dcf68a31a2de064dd8471.jpg)
[error record] configure NDK header file path in Visual Studio

Unity elementary case notes of angry birds Siki college 1-6

NLP pre training technology development
![[error record] configure NDK header file path in Visual Studio (three header file paths of NDK | ASM header file path selection related to CPU architecture)](/img/44/aa4963d07d046deb2bc76eb59f8ff7.jpg)
[error record] configure NDK header file path in Visual Studio (three header file paths of NDK | ASM header file path selection related to CPU architecture)
随机推荐
Similarities and differences of text similarity between Jaccard and cosine
Beijing invites reporters and media
ISBN number
功能:求5行5列矩阵的主、副对角线上元素之和。注意, 两条对角线相交的元素只加一次。例如:主函数中给出的矩阵的两条对角线的和为45。
7.1 学习内容
Regular expression of shell script value
网上的低佣金链接安全吗?招商证券怎么开户?
Qtcharts notes (V) scatter diagram qscatterseries
Pair
[CSDN Q & A] experience and suggestions
[leetcode] interview question 17.08 Circus tower
Regular expressions and text processors for shell programming
Global and Chinese market of underwater bags 2022-2028: Research Report on technology, participants, trends, market size and share
国元证券开户是真的安全可靠吗
Eight year test old bird, some suggestions for 1-3 year programmers
【leetcode】374. Guess the size of the number
What are the application fields of digital twins in industry?
Bodong medical sprint Hong Kong stocks: a 9-month loss of 200million Hillhouse and Philips are shareholders
Test the influence of influent swacth on the electromagnetic coil of quartz meter
What is the potential of pocket network, which is favored by well-known investors?