平均同学成绩

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scanner=new Scanner(System.in);
		int score =0;
		int num=0;
		int sumscore =0;
		int avgscore = 0;

		for (int i = 0; i < 5; i++) {
			System.out.println("请输入"+(i+1)+"位同学的成绩:");
			score= scanner.nextInt();
			if (score<=90) {
				
				continue;
			}
			
			num++;
			sumscore = sumscore+score;
			System.out.println((i+1)+"个同学的成绩是:"+ score);
		}
		
		
		//优秀率
				avgscore = sumscore / num;
				System.out.println("符合条件的考试人数:"+ num+",总成绩是:"+sumscore+",优秀率是:"+ avgscore);
				//在开发的时候,continue是可以使用if 代替的
				 

		
	
	}

 

你可能感兴趣的:(Java题目)