当前位置:网站首页>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");
}
}
边栏推荐
- Vibrating liquid quantity detecting device
- Stm32h7b0 replaces the h750 program, causing the MCU to hang up and unable to burn the program
- pybullet机器人仿真环境搭建 5.机器人位姿可视化
- 若依打包如何分离jar包和资源文件?
- GUI+SQLServer考试系统
- 无需人工先验!港大&同济&LunarAI&旷视提出基于语义分组的自监督视觉表征学习,显著提升目标检测、实例分割和语义分割任务!...
- day10每日3题(1):逐步求和得到正数的最小值
- This year, the AI score of college entrance examination English is 134. The research of Fudan Wuda alumni is interesting
- Research on natural transition dubbing processing scheme based on MATLAB
- 最小二乘系统辨识课 中篇:递归最小二乘
猜你喜欢

Cloud platform monitoring system based on stm32+ Huawei cloud IOT design

The first open source MySQL HTAP database in China will be released soon, and the three highlights will be notified in advance
![[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

MS|谢黎炜组发现混合益生菌制剂及其代谢产物可缓解结肠炎

Arduino uno + DS1302 simple time acquisition and serial port printing

Exquisite makeup has become the "soft power" of camping, and the sales of vipshop outdoor beauty and skin care products have surged

【力扣刷题】单调栈:84. 柱状图中最大的矩形

R329 (maix-ii-a (M2A) data summary
![[Li Kou brush questions] 11 Container holding the most water //42 Rain water connection](/img/45/1e712300ea655856762394fba09066.png)
[Li Kou brush questions] 11 Container holding the most water //42 Rain water connection
![[from database deletion to running] JDBC conclusion (finish the series in one day!! run as soon as you finish learning!)](/img/75/2fb1a4e6215e404df34849e9e4f21a.png)
[from database deletion to running] JDBC conclusion (finish the series in one day!! run as soon as you finish learning!)
随机推荐
What is flush software? Is it safe to open an account online?
Développer un opérateur basé sur kubebuilder (démarrer)
Pybullet robot simulation environment construction 5 Robot pose visualization
Codeforces Round #802 (Div. 2)
[从零开始学习FPGA编程-46]:视野篇 - 集成电路的发展与技术进步
Binary array command of redis
[from deleting the database to running] the end of MySQL Foundation (the first step is to run.)
C语言所有知识点小结
Redis的ACID
JS教程之使用 ElectronJS 桌面应用程序打印贴纸/标签
Dialogue with the senior management of Chang'an Mazda, new products will be released in Q4, and space and intelligence will lead the Japanese system
day10每日3题(1):逐步求和得到正数的最小值
In a bad mood, I just write code like this
108. simple chat room 11: realize client group chat
Make up the weakness - Open Source im project openim about initialization / login / friend interface document introduction
Kept to implement redis autofailover (redisha) 1
stm32h7b0替代h750程序导致单片机挂掉无法烧录程序问题
[机缘参悟-31]:鬼谷子-抵巇[xī]篇-危机是危险与机会并存
[understanding of opportunity -31]: Guiguzi - Daoyu [x ī] Crisis is the coexistence of danger and opportunity
【从删库到跑路】JDBC 完结篇(一天学完系列!!学完赶紧跑!)