循环接受成绩
来源:互联网 发布:超越电子教室软件 编辑:程序博客网 时间:2024/06/04 23:30
import java.util.Scanner;
/**
*
*计算五个同学的成绩平均值 学生人数也可自定 循环接收方式
*
**/
public class Chengji{
public static void main(String[] args){
System.out.print("请输入学生的人数:");
Scanner sc = new Scanner(System.in);
int s = sc.nextInt();
int sum=0;
int[] cj = new int[s];
System.out.println("请依次输入学生的成绩");
for(int a=0;a<s;a++){
cj[a]=sc.nextInt();
System.out.println("你输入的第"+(a+1)+"个学生的成绩是:"+cj[a]);
sum = sum +cj[a];
}
System.out.println("总成绩是:"+sum);
int avg= sum/s;
System.out.println("平均分数是:"+avg);
}
}
/**
*
*计算五个同学的成绩平均值 学生人数也可自定 循环接收方式
*
**/
public class Chengji{
public static void main(String[] args){
System.out.print("请输入学生的人数:");
Scanner sc = new Scanner(System.in);
int s = sc.nextInt();
int sum=0;
int[] cj = new int[s];
System.out.println("请依次输入学生的成绩");
for(int a=0;a<s;a++){
cj[a]=sc.nextInt();
System.out.println("你输入的第"+(a+1)+"个学生的成绩是:"+cj[a]);
sum = sum +cj[a];
}
System.out.println("总成绩是:"+sum);
int avg= sum/s;
System.out.println("平均分数是:"+avg);
}
}
0 0
- 循环接受成绩
- Erlang接受消息循环
- 主线程循环接受命令
- 循环输入,将成绩分类
- 死循环中接受命令跳出
- lwip_循环查询方式_接受数据包
- while循环输出学生成绩,平均分
- 循环结构 7-9 统计学生成绩
- 接受
- 接受
- MVC后台创建Json(List),前台接受并循环读取
- 成绩~
- 成绩
- 成绩
- 成绩
- 成绩
- 成绩
- 利用while循环录入班级成绩,并且计算avg
- Ubuntu下创建启动Android studio的快捷方式
- spark java程序入门(三)外部程序调用
- BeautifulSoup使用find_all方法乱码问题
- Debian配置Samba出错解决方法
- Adversial network
- 循环接受成绩
- Leetcode 76 Minimum Window Substring(最小窗口的子串)
- import caffe 时出现Intel MKL FATAL ERROR: Cannot load libmkl_avx2.so or libmkl_def.so.
- Java API—— Random类
- 空心菱形
- codevs3013 单词背诵
- [CodeForces519E]A and B and Lecture Rooms(lca)
- 不用后悔的ListView,GridView万能适配器 - 相同,不同 行布局都能用-下
- Eclipse连接MySQL数据库