当前位置:网站首页>Use the array to calculate the average of N numbers, and output the numbers greater than the average
Use the array to calculate the average of N numbers, and output the numbers greater than the average
2022-06-26 16:41:00 【Muzi..】
#include<stdio.h>
#include<stdlib.h>
#define N 10
double fun(double x[],double *y)
{
int i,j;
double av;
av=0.0;
for(i=0;i<N;i++)
{
av=av+x[i]/N;
}
for(i=j=0;i<N;i++)
{
if(x[i]>av)
y[j++]=x[i];
}
y[j]=-1;
return av;
}
main()
{
int i;
double x[N],y[N];
for(i=0;i<N;i++)
{
x[i]=rand()%50;
printf("%2.0f",x[i]);
printf("\n");
}
printf("\nthe average is:%f\n",fun(x,y));
for(i=0;y[i]>=0;i++)
{
printf("%5.1f",y[i]);
printf("\n");
}
}
边栏推荐
- What is flush software? Is it safe to open an account online?
- 108. 简易聊天室11:实现客户端群聊
- r329(MAIX-II-A(M2A)资料汇总
- R language plotly visualization: Violin graph, multi category variable violin graph, grouped violin graph, split grouped violin graph, two groups of data in each violin graph, each group accounts for
- Solidus labs welcomes zhaojiali, former head of financial innovation in Hong Kong, as a strategic adviser
- stm32h7b0替代h750程序导致单片机挂掉无法烧录程序问题
- I regard it as a dry product with a monthly income of more than 30000 yuan for sidelines and more than 10000 yuan for novices!
- 长安链交易防重之布谷鸟过滤器
- 数据分析----numpy快速入门
- Redis Guide (8): principle and implementation of Qianfan Jingfa distributed lock
猜你喜欢

Big talk Domain Driven Design -- presentation layer and others
Redis Guide (8): principle and implementation of Qianfan Jingfa distributed lock

Research on natural transition dubbing processing scheme based on MATLAB

【力扣刷题】11.盛最多水的容器//42.接雨水

用Attention和微调BERT进行自然语言推断-PyTorch

基於Kubebuilder開發Operator(入門使用)
![[force deduction question] two point search: 4 Find the median of two positive arrays](/img/4f/43aa7e14344e7e1a2fb7c1d209d13b.png)
[force deduction question] two point search: 4 Find the median of two positive arrays

r329(MAIX-II-A(M2A)资料汇总

Supplement the short board - Open Source im project openim about initialization / login / friend interface document introduction
![[Li Kou brush question] monotone stack: 84 The largest rectangle in the histogram](/img/75/440e515c82b5613b117728ba760786.png)
[Li Kou brush question] monotone stack: 84 The largest rectangle in the histogram
随机推荐
Science | 红树林中发现的巨型细菌挑战传统无核膜观念
Mono 的一些实例方法
redis的二进制数组命令
GUI+SQLServer考试系统
Vibrating liquid quantity detecting device
R language generalized linear model function GLM, GLM function to build logistic regression model, analyze whether the model is over discrete, and use the ratio of residual deviation and residual degr
精致妆容成露营“软实力”,唯品会户外美妆护肤产品销量激增
Cuckoo filter for Chang'an chain transaction
The first open source MySQL HTAP database in China will be released soon, and the three highlights will be notified in advance
R language plotly visualization: Violin graph, multi category variable violin graph, grouped violin graph, split grouped violin graph, two groups of data in each violin graph, each group accounts for
Lifeifei's team applied vit to the robot, increased the maximum speed of planning reasoning by 512 times, and also cued hekaiming's Mae
若依微服务特殊字符串被过滤的解决办法
基于STM32+华为云IOT设计的云平台监控系统
[机缘参悟-31]:鬼谷子-抵巇[xī]篇-危机是危险与机会并存
1-12vmware adds SSH function
100+ data science interview questions and answers Summary - basic knowledge and data analysis
【MATLAB项目实战】基于卷积神经网络与双向长短时(CNN-LSTM)融合的锂离子电池剩余使用寿命预测
并发编程整体脉络
Solution for filtering by special string of microservice
心情不好,我就这样写代码