当前位置:网站首页>Output student grades
Output student grades
2022-07-03 14:33:00 【Study hard 867】
This question requires the preparation of procedures , According to the input student's score , Count and output the average score of students 、 Top and bottom . Dynamic memory allocation is recommended for .
Input format :
Enter the first line to first give a positive integer N, Number of students . The next line shows N Results of students , Numbers are separated by spaces .
Output format :
Output in the following format :
average = Average score
max = Top grade
min = Minimum score
Keep two decimal places for results .
sample input :
3
85 90 95
sample output :
average = 90.00
max = 95.00
min = 85.00Code :
#include <stdio.h>
int main(){
int N;
scanf("%d",&N);
double a[N];
double average,max,min,sum=0;
int i,j;
for(i=0;i<N;i++){
scanf("%lf",&a[i]);
sum=sum+a[i];
}
average=sum/N;
max=a[0];
for(i=0;i<N-1;i++){
if(max<a[i+1])max=a[i+1];
}
min=a[0];
for(i=0;i<N-1;i++){
if(min>a[i+1])min=a[i+1];
}
printf("average = %.2lf\nmax = %.2lf\nmin = %.2lf",average,max,min);
}
边栏推荐
- adc128s022 ADC verilog设计实现
- npm install卡住与node-npy的各种奇怪报错
- SSH access control, blocking the IP when logging in repeatedly to prevent brute force cracking
- 7-10 calculate salary
- 修改数据库中的记录为什么报这个错
- 论文分享:Generating Playful Palettes from Images
- 7-16 find the set of integers that meet the given conditions
- 数学常数表 by q779
- 洛谷P4047 [JSOI2010]部落划分 题解
- Luogu p5536 [xr-3] core city solution
猜你喜欢
![[clean up the extraordinary image of Disk C]](/img/0d/331115bc5d82d6337ae975a08494b2.jpg)
[clean up the extraordinary image of Disk C]

基因家族特征分析 - 染色体定位分析

tonybot 人形機器人 紅外遙控玩法 0630

论文分享:Generating Playful Palettes from Images

Exercise 10-6 recursively find Fabonacci sequence

Jiuyi cloud black free encryption free version source code

Programming language: the essence of type system

7-11 calculation of residential water charges by sections

提高效率 Or 增加成本,开发人员应如何理解结对编程?

Happy capital new dual currency fund nearly 4billion yuan completed its first account closing
随机推荐
6-9 statistics of single digits (15 points)
基因家族特征分析 - 染色体定位分析
Paper sharing: generating playful palettes from images
C library function - qsort()
Recent learning summary
String sort
Programming language: the essence of type system
如何查询淘宝天猫的宝贝类目
adc128s022 ADC verilog设计实现
ConstraintLayout 的使用
Eight sorts
别再问自己适不适合做软件测试了
适用于XP的DDK
Thinking about the arrangement problem in the backtracking problem (leetcode questions 46 and 47)
US stock listing of polar: how can the delivery of 55000 units support the valuation of more than 20billion US dollars
7-24 reduction of the simplest fraction (rolling Division)
Use of constraintlayout
Stop asking yourself if you are suitable for software testing
Frequently asked questions: PHP LDAP_ add(): Add: Undefined attribute type in
JVM garbage collector