参赛者成绩
来源:互联网 发布:网络错误图片 编辑:程序博客网 时间:2024/06/10 04:02
package ggg;public class wda {public double calavg(int[] scores) {int sum = 0;double avg = 0.0;for (int i = 0; i < scores.length; i++) {sum += scores[i];}avg = (double) sum / scores.length;return avg;}public int calmax(int[] scores) {int max = scores[0];for (int i = 0; i < scores.length; i++) {if (max < scores[i]) {max = scores[i];}}return max;}}
package ggg;import java.util.*;public class wda1 {public static void main(String[] args) {Scanner input = new Scanner(System.in);wda s = new wda();int[] scores = new int[5];System.out.println("输入5名参赛者的成绩:");for (int i = 0; i < 5; i++) {scores[i] = input.nextInt();}double avgscore = s.calavg(scores);System.out.println("平均成绩:" + avgscore);int max = s.calmax(scores);System.out.println("最高成绩:" + max);}}
0 0
- 参赛者成绩
- 求参赛者的平均分,取最大值
- 成绩~
- 成绩
- 成绩
- 成绩
- 成绩
- 成绩
- 全明星三分大赛参赛者揭晓 猛龙神投手瞄准三连冠
- 通过评委给的分算出改参赛者的最后的分
- 最高成绩,最低成绩,平均成绩处理
- CTSC2010成绩
- 成绩录入
- 成绩-男
- 成绩-全部
- 成绩评级
- 成绩计算
- 成绩转换
- CSS3和Canvas动画
- 玩转【斗鱼直播APP】系列之框架搭建
- Mysql出现Field * doesn't have a default value解决办法
- Raspberry Pi 使用
- 试试CSDN博客搬家功能
- 参赛者成绩
- Java中使用File类操作文件时的路径问题
- Codeforces Round #371 (Div. 2) E. Sonya and Problem Wihtout a Legend (DP/LIS变形)
- 表格内图片定位到页面一角,并随页面大小移动,始终居于此角
- 下载大字体地图还是看不清楚的解决方案
- 作业
- 用有参输入客户姓名及修改姓名
- 写一个缓存系统的伪代码
- 洛谷 P1087 FBI树